1.0.2 • Published 7 years ago

fire-push v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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 alt text

  • Copy the server key in the section cloud messaging alt text

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));