Package Exports
- fire-push
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fire-push) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Fire-Push
Node Package to send push notifications using FCM
Requirements
You must get a api key (server key) from firebase
Create a new project in your firebase console
Copy the server key in the section cloud messaging
Installation
npm install fire-push
Usage
const FirePush = require('fire-push').default;
let config = {
apiKey : 'YOUR_API_KEY'
};
let notificator = new FirePush(config);
let message = {
notification :{
title : 'Ey',
body : 'Make push notifications great again',
sound : 'default'
},
to : '/topics/testing'
};
notificator.sendMessage(message)
.then((result) => console.log("notification sended"))
.catch((error) => console.error(error));
/* You can send message with data too
message.data : {
"extra" : "everything is awesome"
};
*/
notificator.sendMessage(message)
.then((result) => console.log("notification sended"))
.catch((error) => console.error(error));