Search code examples
iosobjective-cfirebasefirebase-cloud-messagingfirebase-notifications

Firebase Notifications - How to Send Notifications only to Specific Users?


I'm building an app using Firebase Notifications where a user can enter their zip code and then receive notifications for specific events happening in their locality.

How do I only send notifications to a specific user? I've tried including Zip Code in the Advanced Options sections of Firebase Notifications, but it still sends the notification to all users.


Solution

  • Seems like Topics is what you are looking for. When the user enters their zipcode you can subscribe them to a topic eg: /topics/zip then you can send to the appropriate zipcode from the console. Subscribing will create the topic if it does not already exist.

    Note: Topics can take up to 24 hours to show up in the console after they are created.