2

Is there a way to unsubscribe all users from a topic in Firebase Cloud messaging without knowing the tokens? Basically, "delete" the topic?

It would be really really painful to do this manually since it should happen with a document change trigger, meaning the function would somehow have to know all the user tokens. So it's either a function/set of functions for "get all tokens for topic, then unsubscribe all of them", or "delete topic". Are there any solutions to this?

just_deko
  • 892
  • 1
  • 12
  • 25

1 Answers1

3

There is no API to unsubscribe all tokens from a specific topic. There also is no API to get a list of tokens for a topic. See How to get client FCM tokens from a FCM topic

Topics are automatically created and deleted by Firebase Cloud Messaging. A topic is created when you first subscribe a token to it, or send a message to it. And it's essentially deleted when you remove the last token from it.

Frank van Puffelen
  • 418,229
  • 62
  • 649
  • 645