This package has been deprecated

Author message:

Package no longer supported. Contact support@npmjs.com for more info.

stratton

2.0.1 • Public • Published

Stratton 2.0.1

A Node.js module for interfacing with Apple Push Notification, Google Cloud Messaging, Microsoft Push Notification and Amazon Device Messaging services.

Installation

$ npm install stratton

Features

  • Simplified.
  • More powerful and intuitive.
  • Multi platform push sends.
  • Automatic detection for destination device type.
  • Improved unified error handling.

Usage

First of all:

IOS: replace cert.txt and key.txt files on stratton folder with your cert.pem and key.pem. 
ANDROID: Add to SETTINGS.js your API SERVER KEY on stratton folder.
FIRE OS: Add to SETTINGS.js your CLIENT ID and CLIENT SECRET on stratton folder.
OPTIONAL: Add to SETTINGS.js your PUSH TITLE (only compatible with IOS, Windows Phone and Fire OS) and PUSH MESSAGE (only compatible with Windows Phone and Fire OS);

Import stratton module:

var stratton = require('stratton');

Define JSON which includes the data you want to send and the pushId field having at least one destination device ID. You can send to multiple devices, independently of platform, creating an array with different destination device IDs.

// Single destination
var json = JSON.parse('{"pushId" : "INSERT_YOUR_DEVICE_ID", "data" : "INSERT_YOUR_DATA" }');

// Multiple destinations
var json = JSON.parse('{ "pushId" : ['INSERT_YOUR_DEVICE_ID1" , "INSERT_YOUR_DEVICE_ID2"] , "data" : "INSERT_YOUR_DATA" }');

Finally send a push notificacion and catch response:

stratton.sendPush(json, function (err,result){
    if (err)
        console.log('Error: ' + result);
    else
        console.log(result);
});

Result will contain 'OK' or 'an error description'.

Resources

Package Sidebar

Install

npm i stratton

Weekly Downloads

2

Version

2.0.1

License

none

Last publish

Collaborators

  • npm