1.0.1 • Published 8 years ago

simple-ionic-push v1.0.1

Weekly downloads
4
License
GNU General Publi...
Repository
github
Last release
8 years ago

#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

NPM

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