Skip to content

pushbots/instapush-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

<tr>
    <td>listEvents</td>
    <td><pre lang="javascript"><code>instapush.listEvents(callback);</code></pre></td>
    <td><a href="https://instapush.im/developer/rest#listevents">Link</a></td>
</tr>
<tr>
    <td>listApps</td>
    <td><pre lang="javascript"><code>instapush.listApps(callback);</code></pre></td>
    <td><a href="http://instapush.im/developer/rest#listapps">Link</a></td>
</tr>
<tr>
    <td>addApp</td>
    <td><pre lang="javascript"><code>instapush.addApp(data,callback);</code></pre></td>
    <td><a href="http://instapush.im/developer/rest#addapp">Link</a></td>
</tr>
<tr>
    <td>addEvent</td>
    <td><pre lang="javascript"><code>instapush.addEvent(data, callback);</code></pre></td>
    <td><a href="http://instapush.im/developer/rest#stats">Link</a></td>
</tr>
Method Example
notify
instapush.notify(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);
});

About

Instapush API client for NodeJs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published