Saturday 20 May 2017

Firebase function to pick FCM token from database

I wanted to send FCM notifications to users.I installed npm and node.js on my pc and need to create JavaScript file and JSON which listen changes in database and if there is any then pick fcm token from database(Which added in database) itself and then send it to make post request to FCM server.

Javascript is not my language that's why i am getting hard time in reading official documentation. I checked few samples from github also but all picking up FCM token from auth directory.

In my scenario- User send message, Which added to Firebase Database,Now firebase function will listen changes and get FCM token,User message body,User Name from Realtime database and send it to FCM server to generate notifications.

How can i achieve this in Index.js file to get desired result. Is this possible to make custom codes for firebase?

How my realtime database look like now.enter image description here



via Ritu

No comments:

Post a Comment