instapush

Instapush API client for Node.js

npm install instapush
14 downloads in the last week
24 downloads in the last month

Instapush

Instapush API client for Node.js

Installation

npm install instapush

Basic Use

var instapush = require('instapush');
//authorize
instapush.settings({
    token: '5295f58f12e23cf5',
    id:'52eed96ea2a8f0f',
    secret:'9a96794fec44481de5',
});

instapush.request('GET','/apps/list' ,function (err, response){
    console.log(response);
});

Helper Methods

The instapush module also includes methods that make working with common API resources a bit simpler:

Method Example
notify
instapush.notify(data,callback);
Link
listEvents
instapush.listEvents(callback);
Link
listApps
instapush.listApps(callback);
Link
addApp
instapush.addApp(data,callback);
Link
addEvent
instapush.addEvent(data, callback);
Link

Full Use


var instapush = require('instapush');
//authorize
instapush.settings({
    ssl : true,
    token:'5295f58e23cf5',
    id:'52a221ab1284567',
    secret:'ad50d9eda8fdbc4b9a6',
});

//send a push notification triggered with the search event
instapush.notify({"event":"search","trackers":{"term":"api"}} ,function (err, response){
    console.log(response);
});

//list all events for the app, using the id and secret
instapush.listEvents(function (err, response){
    console.log(response);
});
//list all apps for a user using user token
instapush.listApps(function (err, response){
    console.log(response);
});


//adding a new event to an application
data = {"title":"nodejsEvent2",
        "trackers":["name","country"],
        "message":"{name} from {country} sucked."
        };
instapush.addEvent(data,function (err, response){
    console.log(response);
});

instapush.addApp({"title":"NodeJSAPP"},function (err, response){
    console.log(response);
});
npm loves you