Last active
July 2, 2016 01:51
-
-
Save ans-4175/6b264f7de11983ccbde601e0727b2047 to your computer and use it in GitHub Desktop.
Example Using of fcm-push-notif modules https://github.com/eFishery/fcm-push-notif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var FCM = require('fcm-push-notif'); | |
var serverKey = 'firebase_server_key'; | |
var fcm = new FCM(serverKey); | |
var message = { | |
to: '/topics/news', // required could be topic url or device registration token | |
collapse_key: 'your_collapse_key', | |
data: { | |
message: 'This is data message' | |
}, | |
notification: { | |
title: 'Test', | |
body: 'test message' | |
} | |
}; | |
fcm.send(message) | |
.then(function(response){ | |
console.log("Successfully sent with response: ", response); | |
}) | |
.catch(function(err){ | |
console.log("Something has gone wrong!"); | |
console.error(err); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment