node js send fcm
var FCM = require('fcm-node')
var serverKey = require('path/to/privatekey.json') //put the generated private key path here
var fcm = new FCM(serverKey)
var message = { //this may vary according to the message type (single recipient, multicast, topic, et cetera)
to: 'registration_token',
collapse_key: 'your_collapse_key',
notification: {
title: 'Title of your push notification',
body: 'Body of your push notification'
},
data: { //you can send only notification or only data(or include both)
my_key: 'my value',
my_another_key: 'my another value'
}
}
fcm.send(message, function(err, response){
if (err) {
console.log("Something has gone wrong!")
} else {
console.log("Successfully sent with response: ", response)
}
})
Also in JavaScript:
- generate random color jquery
- find even numbers in an array javascript
- export app react native
- express js continous GET /json/version
- javascript get stack trace
- cordova load javascript without cache
- pageyoffset jquery
- nodelist to array
- what does function setup() do in javascript
- Javascript parse json string
- how to use a fixed time zone in nodejs
- getElementbyhref
- map in javascript
- delete from list javascript
- js code to run hello world
- difference between React Native and React
- js redirect to relative url
- react set title of page
- mongoose query with function(req, res, next)
- javascript style
- js random generator
- método pop javascript
- if button is keeping pressed execute increment javascript
- store data in browser javascript