Count subscribers of a topic in Firebase Cloud Messaging
U can use this to get number of subscribers :
- Go to the Firebase Console "https://console.firebase.google.com/"
- Under Grow, click Cloud Messaging.
- Open up your developer tools.
- Click New Notification and type some title and message
- On Target Tab , click on Topic
- In the network tab in developer tool you will see a request to an url similar to this one https://gcmcontextualcampaign-pa.clients6.google.com/v1/4/projects/${projectId}/topics?prefix=%2Ftopics%2F&key=${key}
Copy as a curl. Use that to get subscribers list
Reference: https://gist.github.com/timrijckaert/218be90541a7285e21455fafa2962dea
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.