What I want to do with my app is this: users can select different interests and as soon as there are more than ~5 people interested in the same thing, I want to send them a notification.
I thought Firebase + Topics would be a good choice for this.
But how do I find out how many people have subscribed to a topic?
There is no direct way of doing this. Your only two options are:
There are so many problems with both of these methods though. It's frustrating topic managmenet doesn't already exist in FCM Console. I wrote Google a feature request for FCM Cloud Notification Topic Management and this is the response I got:
There is no available API to check how many subscribers a topic has. (see my answer here)
You'll have to implement the mapping on your server-side, saving the name of the topics and adding in the list of subscribers. Upon subscription, add the new subscriber, check the count (see if it's within your preferred number), then trigger a notification.