fire-push

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i fire-push

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • dezkareid
  • jesuslerma