push-notification-kit
v1.0.3
Published
Push Notification kit for Google Cloud Messaging
Downloads
6
Maintainers
Readme
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