Does anyone know how to delete a client topic from the Firebase Console?
Asked
Active
Viewed 1.4k times
21
1 Answers
29
There is no way to delete a topic
directly. Not even if you have an app server. That's what I can say after going through the GCM and FCM documents.
The way I understand it, a topic
is created when there is at least 1 subscriber and it also gets automatically deleted when there are no more subscribers. So I think the way to do this is to unsubscribe all the subscribers of that topic
.
You can check more details on unsubscribing in the Managing Topic Subscriptions on the Server docs (both sites below pretty much says the same thing, but I think it's appropriate to provide a link to both of them):
- https://firebase.google.com/docs/cloud-messaging/topic-messaging#managing_topic_subscriptions_from_the_server
- https://developers.google.com/cloud-messaging/topic-messaging#managing_topic_subscriptions_from_the_server
Hope this helps somehow. Cheers! :)

AL.
- 36,815
- 10
- 142
- 281
-
What if you don't know all subscribers? In our case old topics can be removed, because no messages are send ever again. But we don't keep our own list of subscribed users to that topic. After all that is one benefit of FCM over GCM. I heard that there is a max of 2000 subscribed topics per user. So if you are not tracking each invidual topic per user and reaching the 2000 limit. What is happening and how to solve this? – Gillis Haasnoot Mar 12 '19 at 00:18
-
I presume you found the 2000 limit [here](https://stackoverflow.com/a/48334967/4625829). Like what I mentioned in my comment, there isn't any official document that states that limit -- if you want to make sure that the limit is *still (?)* 2000, I suggest doing a test of your own. I haven't experienced reaching the limit (I can't even imagine having a single token subscribed to that many), but it says on the post that you will receive an error. There is currently no way to delete a topic, the only solution right now is to keep track of the subscription (either by topic or by user). – AL. Mar 12 '19 at 03:20
-
8In our case users can subscribe on upcoming sports events. After a year of using the app many users have subscribed to over 2000 topics. Of course from which 90% is no longer used since they are all old events. Thats the reason why I simply want to remove all users from a specific topic. Very annoying that this feature is not available. – Gillis Haasnoot Mar 17 '19 at 22:46
-
In my case I just want to make sure message to particular user is not sent twice until he subscribes again also in my case, subscribing and sending message to topic are distributed processes hence at time of sending I don't have user's records to unsubscribe. – Shobhit Mishra May 15 '19 at 09:49
-
1@AL. The behaviour you have mentioned is no happening to me. I have created a topic and I have unsubscribed all the users from the created topic still the topic exist over the firebase and not deleted automatically though I did not get any notifications after unsubscribe ( which is right behaviour). When there are no subscribers the topic still remain same as it is. – Shashank Shah Dec 29 '20 at 07:38
-
@ShashankShah The topics listed on the Firebase console don't update realtime. Give it about 24-48 hours – AL. Dec 30 '20 at 08:03