Guest User

Untitled

a guest
Jul 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. var FCM = require('fcm-node');
  2. var serverKey = 'SERVER-KEY-COMES-HERE'; //put your server key here
  3. var fcm = new FCM(serverKey);
  4.  
  5. var message = {
  6. "to":'FCM-TOKEN-COMES-HERE',
  7. "content_available": true,
  8. "mutable_content": true,
  9. "notification": {
  10. "title": 'title comes here',
  11. "body": 'body comes here',
  12. "sound": "default",
  13. },
  14. "data": {
  15. "title": 'title comes here',
  16. "body": 'body comes here',
  17. "custom_var": 'yes'
  18. }
  19. };
  20.  
  21. fcm.send(message, function (err, response) {
  22. if (err) {
  23. console.log('error);
  24. } else {
  25. console.log("Successfully sent with response: ", response);
  26. }
  27. });
Add Comment
Please, Sign In to add comment