A Node.JS simple interface to Google's Firebase Cloud Messaging (FCM)
Via npm:
$ npm install fcm-push
var FCM = require('fcm-push');
var serverKey = '';
var fcm = new FCM(serverKey);
var message = {
to: 'registration_token',
collapse_key: 'your_collapse_key',
data: {
your_custom_data_key: 'your_custom_data_value'
},
notification: {
title: 'Title of your push notification',
body: 'Body of your push notification',
icon: 'ic_launcher' //now required
}
};
fcm.send(message, function(err, response){
if (err) {
console.log("Something has gone wrong!");
} else {
console.log("Successfully sent with response: ", response);
}
});
See FCM documentation for details.
Extended by Leonardo Pereira. Based on the great work on fcm-push by Rasmunandar Rustam cloned and modified from there, which in its turn, was cloned and modified from Changshin Lee's node-gcm
GNU LESSER GENERAL PUBLIC LICENSE v3
1.0 forked from fcm-push and implemented topic messages return codes