Tenzin Choklang
Tenzin Choklang

Reputation: 523

firebase how to send push notifications automatically

How would i send a push notification automatically, instead of doing it through the firebase console manually. Like when user invites another user send a notification to the user that they have been invited. I am getting the user device token by doing firebase.messaging().getToken();

Upvotes: 1

Views: 1751

Answers (3)

AKovalev
AKovalev

Reputation: 61

If you use firebase DB and want to send push notification by some actions (for example, new record in your db ), you can try to use firebase functions. See here for more information

In any other ways - you should create your own server app that will be connected with fcm or apn services and your db. Of course, you should configure your server app correctly.

Upvotes: 1

You would need to develop your own server where you need to save device token and send push notifications based on various triggers.

Alternate way - if you are using other Firebase services like Firestore - you can go with Firebase Functions. Here is quick overview: https://firebase.google.com/docs/functions/use-cases

Upvotes: 3

Hanaa Mohamed
Hanaa Mohamed

Reputation: 117

Do it through your backend, First you need to register users' token on your backend and when userA send invitation to userB send that request to the backend and your backend should have userB token, it will send userB notification.

Upvotes: 2

Related Questions