push-notification-kit

1.0.3 • Public • Published

Push Notification Kit

This Kit serves as a starter kit for Firebase's Google Cloud Messaging and Node.js where you can setup and send push notifications to all subscribed devices on a specific topic.

Features

  • Send Messages to specific topic that devices are subscribed, containing title and body.

Installation

PushNotification Kit requires Node.js v4+, Google Cloud Messaging Activated Account, and a project already setup.

Install the dependencies and instanciate the PushNotification class.

Usage

var PushNotification = require('push-notification-kit');
var pn = new PushNotification('PATH_TO_GOOGLE_SERVICES.JSON');
 
pn.notify({project_id: 'PROJECTNAME', topic: 'My Topic', title: 'My Title',body: 'Testing Body'}).then((response) => { // -> If message was sent with no error
    console.log(response)
})
.catch((err) => { // -> If there was an error
    console.log(err);
})
 

License

MIT

Package Sidebar

Install

npm i push-notification-kit

Weekly Downloads

0

Version

1.0.3

License

ISC

Last publish

Collaborators

  • edisoncury