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.
Hi there @timrijckaert ,
Thank you for your work !
However the script is not working for me, I get stuck with response 403 : "The caller does not have permission".
When I change one of the cookie info or else, I found another issue (401 "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.") which let me think that the parameters I set are corrects.
I also try to add all information I could find from the original cookie header into your function, still stuck with 403.
Is this script still working for you ? Am I missing something ?
I use firebase backend functions in order to call the console api from a firebase env.
Thanks,
Orazio