├── fcm.js ├── package-lock.json └── package.json /fcm.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | var FCM = require('fcm-node'); 5 | var serverKey = ''; 6 | var fcm = new FCM(serverKey); 7 | 8 | var message = { 9 | to:'', 10 | notification: { 11 | title: 'NotifcatioTestAPP', 12 | body: '{"Message from node js app"}', 13 | }, 14 | 15 | data: { //you can send only notification or only data(or include both) 16 | title: 'ok cdfsdsdfsd', 17 | body: '{"name" : "okg ooggle ogrlrl","product_id" : "123","final_price" : "0.00035"}' 18 | } 19 | 20 | }; 21 | 22 | fcm.send(message, function(err, response) { 23 | if (err) { 24 | console.log("Something has gone wrong!"+err); 25 | console.log("Respponse:! "+response); 26 | } else { 27 | // showToast("Successfully sent with response"); 28 | console.log("Successfully sent with response: ", response); 29 | } 30 | 31 | }); 32 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs-app", 3 | "version": "1.0.0", 4 | "main": "fcm.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "author": "clear", 9 | "license": "ISC", 10 | "description": "", 11 | "dependencies": { 12 | "fcm-node": "^1.6.1" 13 | } 14 | } 15 | --------------------------------------------------------------------------------