Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var FCM = require('fcm-node');
- var serverKey = 'SERVER-KEY-COMES-HERE'; //put your server key here
- var fcm = new FCM(serverKey);
- var message = {
- "to":'FCM-TOKEN-COMES-HERE',
- "content_available": true,
- "mutable_content": true,
- "notification": {
- "title": 'title comes here',
- "body": 'body comes here',
- "sound": "default",
- },
- "data": {
- "title": 'title comes here',
- "body": 'body comes here',
- "custom_var": 'yes'
- }
- };
- fcm.send(message, function (err, response) {
- if (err) {
- console.log('error);
- } else {
- console.log("Successfully sent with response: ", response);
- }
- });
Add Comment
Please, Sign In to add comment