Introduction

Instapush uses a simple REST API to receive messages from your application and send them to devices running our mobile clients. And for those who don't want to use the web interface, you can also use the API to create apps and events remotely.


Authentication

Performing any activity on our API you'll need USER-TOKEN for listing and adding apps. APPLICATION-ID and APPLICATION-SECRET for list and adding events as well as sending notifications. Those parmaeters are passed as headers in your HTTP request. ex:

 curl -X POST \
      -H "x-instapush-appid: 52d477b2a4c48a" \
      -H "x-instapush-appsecret: 2364eb29c3774016fd8" \
      -H "Content-Type: application/json" \
      -d '{"event":"signups","trackers":{"email":"myemail "}}' \
      https://api.instapush.im/v1/post
  
    

User token can be found in your dashboard info section




1. Apps

You can use the API to view your apps and add a new app.


1. List

URL
https://api.instapush.im/v1/apps/list
Description Get list of your apps
MethodGET
Request Headers :
Parameter Desription
X-INSTAPUSH-TOKEN Your user token.
cURL example
	curl -X GET \
    -H "x-instapush-token: 5295fsa1298773s0a2ce23cf5" \
    https://api.instapush.im/v1/apps/list
    
Response
Success
[
    {
        "title": "App",
        "appID": "522123214s773ef3cs",
        "appSecret": "cb7bf9214212412f2942bc7ds"
    },
    {
        "title": "Other app",
        "appID": "52a221a1232137739d0b",
        "appSecret": "ad50d91232138fd143993444"
    }]
Failure
{
    "msg": "Invalid User Token",
    "error": true,
    "status": 401
}

2. Add App

URL
https://api.instapush.im/v1/apps/add
Description Creates a new app
MethodPOST
FormatJSON
Request Headers :
Parameter Desription
X-INSTAPUSH-TOKEN Your user token.
Parameters: JSON Payload
Parameter Status Type Description
title REQUIRED String App title
cURL example
curl -X POST \
    -H "x-instapush-token: 5215f58saw230a2ce23cf5" \
    -H "Content-Type: application/json" \
    -d '{"title":"test"}' \
    https://api.instapush.im/v1/apps/add
    
Response
Success
{
    "msg": "App Created Successfully",
    "id": "52eff247a4c48a",
    "secret": "5dcb8f6b943879972ad",
    "error": false,
    "status": 201
}
Failure
{
    "msg": "Invalid User Token",
    "error": true,
    "status": 401
}

2. Events

Instapush is event-based

Lets say you want to get notified about new signups into your app. Each event has trackers; information that you'l need to know: email and maybe country of the user. Finally, you need to specify the push message: a template including names of those trackers {email} has signed up from {country}

You can use the API to view your events and add a new event.

1. List

URL
https://api.instapush.im/v1/events/list
Description Get list of your events for a specific app using APPID and APPSECRET.
MethodGET
Request Headers :
Parameter Desription
X-INSTAPUSH-APPID Your app unique ID.
X-INSTAPUSH-APPSECRET Your app unique SECRET.
cURL example
curl -X GET \
    -H "x-instapush-appid: 52d477b2a4c4saswqwqewqeasd" \
    -H "x-instapush-appsecret: 2364231421ca4016fd80e9b7a471f97a" \
    https://api.instapush.im/v1/events/list
    
Response
Success
   [{
        "title": "test_event",
       "trackers": [
            "param1",
            "param2"
        ]
    }]
Failure
{
    "msg": "Wrong APPID or APPSECRET",
    "error": true,
    "status": 401
}

2. Add Event

URL
https://api.instapush.im/v1/events/add
Description Creates a new event
MethodPOST
FormatJSON
Request Headers :
Parameter Desription
X-INSTAPUSH-APPID Your app unique ID.
X-INSTAPUSH-APPSECRET Your app unique SECRET.
Parameters: JSON Payload
Parameter Status Type Description
title REQUIRED String App title
trackers REQUIRED array Parameters you want to use within the event.
message REQUIRED String the push message pattern ex: {user} has purchased a {price} package.
cURL example
curl -X POST \
    -H "x-instapush-appid: 52d477b2a4c48a5sa7068a0f" \
    -H "x-instapush-appsecret: 2364eb29c37f74016fd80eb7a471f97a" \
    -H "Content-Type: application/json" \
    -d '{"title":"MYAPI","trackers":["email","country"],"message":"{email} has signed up from {country}"' \
    https://api.instapush.im/v1/events/add
    
Response
Success
{
    "msg": "Event Created Succesfully",
    "error": false,
    "status": 201
}
Failure
{
    "msg": "Wrong APPID or APPSECRET",
    "error": true,
    "status": 401
}

3. Notifications

Deliver notifications to devices triggered by events.


Send notification

URL
https://api.instapush.im/v1/post
Description Send notification to devices triggered by specific event.
MethodPOST
FormatJSON
Request Headers :
Parameter Desription
X-INSTAPUSH-APPID Your app unique ID.
X-INSTAPUSH-APPSECRET Your app unique SECRET.
Parameters: JSON Payload
Parameter Status Type Description
event REQUIRED String event name
trackers REQUIRED Object Parameters you use within the event with their values
cURL example
 curl -X POST \
      -H "x-instapush-appid: 52d477sb2a4c48a" \
      -H "x-instapush-appsecret: 2364eb2s9c3774016fd8" \
      -H "Content-Type: application/json" \
      -d '{"event":"signups","trackers":{"email":"myemail "}}' \
      https://api.instapush.im/v1/post
  
    
Response
Success
{
    "msg": "Notification Sent Succesfully",
    "error": false,
    "status": 201
}
Failure
{
    "msg": "Wrong APPID or APPSECRET",
    "error": true,
    "status": 401
}

API Versions

Currently we are using API version 1. All API calls should be routed this way https://api.instapush.im/v1/ You can also use https://api.instapush.im/ for the latest version, but you are encouraged to use versions to avoid possible errors when upgrading API.