dimanche 6 juin 2021

Sending FCM messages to web apps through firebase cloud functions

Is it possible to send FCM notifications through Firebase Cloud Functions, when a Firestore data field changes, but for a website, not an app. There is lots of guidance out there for Android and iOS but nothing for simply web apps, outside of sending notifications from the Firebase Console).

I've been trying to find out how to trigger a notification from Cloud Functions but can't find anything useful.

As an example, my database has the following structure:

  • Collection: users
  • Documents: documents named using userID
  • Data Fields: Fields 1 through 5. Field 5 stores the FCM Token. Field 1 stores their status (online, offline, offline pending messages).

I would like to ensure that when Data Field 1 changes (to 'offline pending messages), that the relevant user gets notified (based on the Doc ID).




Aucun commentaire:

Enregistrer un commentaire