JSPM

fire-push

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q25946F
  • License MIT

Package to send push notifications using fcm

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