This little script will output the amount of tokens subscribed to a topic.
You will need to replace the variables with your personal ones in order for it to work.
We used this function in a Lambda which sends the results to a monitoring dashboard.
Screenshots in the comments.
-
Go to the Firebase Console.
-
Under Grow click Cloud Messaging.
-
Open up your developer tools.
-
Typ in a fake notification text
-
Click Next
-
Under the Target tab click Topic
-
In the network tab 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} -
Save your projectId and key in the script
-
Still in the developer tools, under the Application tab go to Cookies
-
Click on the https://console.firebase.google.com site
-
Here you will find the SID, HSID, SSID, APISID and the SAPISID
-
Save these in the script.
In my case I missing the "X-Goog-AuthUser" header, maybe because my browser session is using multiple accounts.