Is there any way to send notifications from FCM from a node.js server?
I haven\'t found anything about it inside documentation.
const admin = require('firebase-admin');
const payload = {
notification: {
title: 'this is title', body: 'this is body'
},
data: {
balance: 100,
priceplanId: 1235
}
}
const deviceToken ='yourtoekn' | ['yourtoekn'];
admin.messaging().sendToDevice(deviceToken, newpayload)
.then((_response) => console.log(_response))
.catch(error => console.log(error));
emphasized text You can send a notification to both ios and Android devices;