1.0.1 • Published 8 years ago
simple-ionic-push v1.0.1
#Simple Ionic Push This is a simple to way to push notifications to the ionic API server with your node server.
Install Simple-Ionic-Push
$ npm install --save simple-ionic-push
##Require the package
var ionicPush = require('simple-ionic-push')('Your API Token from Ionic');
Pushes will return a promise, and passed the success or error responses from the Ionic API.
##Sending a push
var tokens = [];
tokens.push('yourDeviceToken');
var notification = {
"tokens": tokens,
"profile": "prod",
"notification": {
"message": "Hello World!"
}
};
ionicPush.send(notification).then(function(response) {
return res.status(201).send(response);
}, function(error) {
return res.status(400).send(error);
});