Back to top

Introduction

Pushchamp is a cross-platform user engagement solution for marketers and developers. Marketers can use Pushchamp to track user events on website, Android and iOS app. This user data can be used to segment users, automate notifications and run targeted marketing campaigns. Developers can use Pushchamp’s SINGLE API to send push notifications to any platform.

This documentation specifies the following:

  • How to configure Pushchamp on Website, Android application and iOS application.

  • How to configure Push notifications and Emails on various platforms.

  • Rest APIs to Send notifications, Subscribe users and Track notifications.

Getting Started

Login on Pushchamp dashboard and go to application page. Click “create application”. Now provide details of the platforms you want to use Pushchamp for. Follow the instructions to generate keys for each of the platform.


Web

Configuration

Copy paste the below code to all of your HTML pages before the end of body tag. Replace <PUSHCHAMP_APP_ID> with your APP ID found in Dashboard > Developer > API keys.

<script type="text/javascript">
(function(c,h,a,m,p,s){s=c.createElement(h);s.src='https://d38jt33bvxoy1.cloudfront.net/static/SDK/pcanalytics-1.0.3.min.js'+'?pcid='+a+'&pcses='+m;s.type="text/javascript";s.async=!0;p=c.getElementsByTagName(h); p=p[p.length-1]; p.parentNode.insertBefore(s,p);
})(document,'script','<PUSHCHAMP_APP_ID>','1800');
</script>

Integrating Web Push

Pushchamp supports web push notifications on all supported browsers - Chrome, Safari and Firefox. Though, to send push notifications to users on your website, you will need their permission (see image below).

Permission Ask

To configure this, login on Pushchamp dashboard and go to “Bell your website”. Follow the instructions to generate code and copy paste it to your HTML page.

Bell Your Website

Tracking Events

Pushchamp SDK by default tracks all the URLs visited. If you want to track custom events, please use the below code.

pclog.event(EVENT NAME, EVENT EXTRA DATA)

Eg pclog.event(“Item Purchase”, {“product”: “shoes”, “price”: “$200”})

Managing Tags

Tags are like properties. Tags can be things like email, mobile, userid, login id, fb_login_email, etc. You can tag your user with any number of key value pairs to notify them using tags.

Adding Tags

Since email, mobile and userid are the most commonly used tags, we have direct functions for them. Please use these only, if you are tagging email, mobile and userid. It will help you while runinng campaigns.

pushchamp.addEmail(“value”);

pushchamp.addMobile(“value”);

pushchamp.addUserID(“value”);

If there is anything else apart from this, please use the following

pushchamp.addTag(“tag_key”, “tag_value”);

Eg: pushchamp.addTag(“login_id”, “hacker@007”);

Deleting Tags

You can delete previous tags. For example if you had tagged your user using login ID and the user logs out, you can remove the tag.

For Email, Mobile and UserID

pushchamp.deleteEmail();

pushchamp.deleteMobile();

pushchamp.deleteUserID();

For Other tags

pushchamp.deleteTag(“tag_key”);

Eg: pushchamp.deleteTag(“login_id”);

updating Tags

Adding multiple tags and removing any previous one/s.

pushchamp.updateTags({“new_tag”: “new_tag_value”}, [“to_delete_tag_keys”]);

Eg: pushchamp.updateTags({“fb_email”: "hacker007@maildomain.com"}, [“login_id”]);

Managing Groups

Groups are segments to which any user can belong. For example, shoe_buyers or premium_user.

Adding to Group

pushchamp.addGroups([“Group name”]);

Eg: pushchamp.addGroups([“Premium User”]);

Deleting from Group

If you want to remove a group from a user.

pushchamp.deleteGroups([“Group name”]);

Eg: pushchamp.deleteGroups([“Premium User”]);


Android

Configuration

Open build.gradle file of your application in Android Studio. Copy paste the below line in dependencies section.

compile ‘com.pushchamp:app:1.+’

Sample:

android push notification step 5

Open strings.xml file and add the following lines. Replace GOOGLE SENDER ID with your google project number (You can get it from google or firebase console). Replace PUSHCHAMP APP IDENTIFIER with your pushchamp’s app id. You can find it on Pushchamp dashboard > Developers > API keys.

<string name="google_sender_id">GOOGLE SENDER ID</string>
<string name="pushchamp_app_id">PUSHCHAMP APP IDENTIFIER</string>

Open your app’s Android Manifest file and add the following inside application tag.

<meta-data android:value="@string/pushchamp_app_id" android:name="pushchamp_app_id"/>
<meta-data android:value="@string/google_sender_id" android:name="google_sender_id"/>

Next, add this to your application class

PushChamp.enableTrackingWith(this);

Application class example

package com.abhinavsingh.test;

import com.pushchamp.PushChamp;

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        PushChamp.enableTrackingWith(this);
    }
}

Tracking Events

SDK tracks all activities by default. To track custom events use the below code.

PushChampCustomEvent.getInstance().trackEvent(getApplicationContext(),new Events(EVENT NAME HERE)

.addCustomEventData(CUSTOM EVENT KEY 1,CUSTOM EVENT VALUE 1)

.addCustomEventData(CUSTOM EVENT KEY 2,CUSTOM EVENT VALUE 2)

.addCustomEventData(CUSTOM EVENT KEY 3,CUSTOM EVENT VALUE 3));

Managing Tags

Tags are like properties. A tag can be an email, mobile, userid, login id, fb_login_email, etc. You can tag your user with any number of key-value pairs to notify them using tags.

Adding Tags

Since email, mobile and userid are the most commonly used tags, we have direct functions for them. Please use these only if you are tagging email, mobile and ‘user_id’. It will help you while running campaigns.

PushchampSubscription ps = new PushchampSubscription(MainActivity.this, “Your App Identifier”);

ps.addEmail(“value”);

ps.addMobile(“value”);

ps.addUserID(“value”);

If there is anything else apart from this, please use the following

PushchampSubscription ps = new PushchampSubscription(MainActivity.this, “Your App Identifier”);

ps.addTag(“tag_key”, “tag_value”);

Eg: ps.addTag(“login_id”, “hacker@007”);

Deleting Tags

You can delete previous tags. For example if you had tagged your user using login ID and the user logs out, you can remove the tag.

For Email, Mobile and UserID

PushchampSubscription ps = new PushchampSubscription(MainActivity.this, “Your App Identifier”);

pushchamp.deleteEmail();

pushchamp.deleteMobile();

pushchamp.deleteUserID();

For other tags

PushchampSubscription ps = new PushchampSubscription(MainActivity.this, “Your App Identifier”);

ps.deleteTag(“tag_key”);

Eg: ps.deleteTag(“login_id”);

Updating Tags

if you want to add/delete multiple tags simultaneously, use this.

PushchampSubscription ps = new PushchampSubscription(MainActivity.this, “Your App Identifier”);

HashMap<String, String> tags = new HashMap<String, String>();

tags.put(“tag_key”, “tag_value”);

String delete_tags[] = {“to_delete_tag_key”};

ps.updateTags(tags, delete_tags);

Managing Groups

Groups are segments to which any user can belong. For example shoe_buyers or premium_user.

Adding Groups

String[] add_groups = {“group_name”};

ps.addGroups(add_groups);

Eg: ps.addGroups(“Premium User”);

Deleting Groups

Deleting a group from a user.

String[] deleteGroups = {“delete_tag_key”};

ps.deleteGroups(deleteGroups);

Eg: ps.deleteGroups(“login_id”);


iOS

Configuration

You can use Pushchamp through CocoaPods. To install it open your Podfile and add the following.

pod “PushChamp”

Then run

pod install

In your didRegisterForRemoteNotificationsWithDeviceToken function in AppDelegate.m add the following

PushchampSubscription *ps = [[PushchampSubscription alloc] init: @“PUSHCHAMP_APP_ID”];

[ps register: @“PUSH NOTIFICATION TOKEN”];

Tracking Events

Pushchamp SDK tracks all the View Controllers by default. To track custom events do the following

PushchampSubscription *ps = [[PushchampSubscription alloc] init: @“PUSHCHAMP_APP_ID”];

[ps track: @“EVENT NAME” properties: @{@“EXTRA KEY”: @“EXTRA VALUE” }];

Managing Tags

Tags are like properties. A tag can be an email, mobile, userid, login id, fb_login_email, etc. You can tag your user with any number of key-value pairs to notify them using tags.

Adding Tags

Since email, mobile and userid are the most commonly used tags, we have direct functions for them. Please use these only if you are tagging email, mobile and userid. It will help you while runinng campaigns.

[ps addEmail: email: @“value”];

[ps addMobile: mobile: @“value”];

[ps addUserID: userid: @“value”];

If there is anything else apart from this, please use the following

PushchampSubscription *ds = [[PushchampSubscription alloc] init: @“App Identifier”];

[ps addTag: @“tag_key” value: @“value”];

Deleting Tags

You can delete previous tags. For example if you had tagged your user using login ID and the user logs out, you can remove the tag.

For Email, Mobile and UserID

PushchampSubscription *ds = [[PushchampSubscription alloc] init: @“App Identifier”];

[ps deleteEmail];

[ps deleteMobile];

[ps deleteUserID];

For other tags

PushchampSubscription *ds = [[PushchampSubscription alloc] init: @“App Identifier”];

[ps deleteTag: @“tag_key”];

Updating Tags

if you want to add/delete multiple tags simultaneously, use this.

PushchampSubscription *ds = [[PushchampSubscription alloc] init: @“App Identifier”];

NSMutableDictionary *add_tags = [[NSMutableDictionary alloc]init];

[add_tags setObject: @“new@gmail.com” forKey: @“email”];

NSMutableArray *del_tags = [[NSMutableArray alloc]init];

[del_tags addObject: @“email”];

[ds updateTags:add_tags delete_tags:del_tags];

Managing Groups

Groups are segments to which any user can belong. For example shoe_buyers or premium_user.

PushchampSubscription *ds = [[PushchampSubscription alloc] init: @“App Identifier”];

NSMutableArray *groups = [[NSMutableArray alloc]init];

[groups addObject: @“premium_user”];

[ds addGroups:groups];

Deleting Groups

Deleting a group from a user.

PushchampSubscription *ds = [[PushchampSubscription alloc] init: @“App Identifier”];

NSMutableArray *groups = [[NSMutableArray alloc]init];

[groups addObject: @“premium_user”];

[ds deleteGroups:groups];


Platform Configurations

Firefox and Chrome

Chrome and Firefox only allows HTTPS supported websites to receive push notifications.

If you don’t have HTTPS supported website then you can create subdomin on pushchamp by default

If your website supports HTTPS connection, then for chrome provide your GCM key or Default PushChamp’s GCM key will be used.

Safari

For Safari, you need to add certificate. To add certificate follow steps shown below:

1. Go to Apple Developer center > Certificates, ID & Profiles > Website Push IDs. Click plus icon.

safari push notification step 1

2. Provide project description and identifier. Idenfier has to be in the format of ‘web.com.appname’. Click continue

safari push notification step 2

3. Click on Register button.

safari push notification step 3

4. Click on Edit button.

safari push notification step 4

5. Click on Create certificate.

safari push notification step 5

6. You will land on Create CSR certificate. Follow the instructions and click continue. safari push notification step 6

7. Upload the generated certificate.

safari push notification step 7

8. Download the certificate file and open.

safari push notification step 8

9. In keychain look for your certificate and right click. Export certificate. It will generate a ‘.p12’ file. Save it. Upload the file in safari key below and provide the certificate password (This is only applicable if you uncheck make for me key).

safari push notification step 9

Android

1. Go to Firebase Console. You will need google account to do so. Create New Project.

android push notification step 1

2. Enter a Project name and select your Country/region

android push notification step 2

3. Go to Project Setting as shown below and select CLOUD MESSAGING section.

android push notification step 3

4. You will see your Server key (legacy token) and Sender ID. If Server key is not found, click on Generate key and you will have your server key. Copy the Server Key and Fill in API key and the Sender Id in Project Number.

android push notification step 4

iOS

1. Open Keychain Access and go to Cetificate Assistant > Request a Certificate from a Certificate Authority.

ios step 1

2. Provide details and save to disk

ios step 2

3. Open Apple Developer console. Go to Certificates, ID & Profiles > App IDs > Click on your project > Cick Edit.

ios step 3

4. Go to section Push Notifications and follow the next steps to configure both Development and Production Certificate.

ios step 4

5. Click Continue.

ios step 5

6. Choose the certificate file (.csr) we created in first 2 steps. Click continue.

ios step 6

7. Download the certificate and open. It will open the certificate in KeyChain Access.

ios step 7

8. Right click on your certificate and click Export “Certificate name”. Enter details and save the .p12 file. Now upload both the production and development p12 files below on PushChamp’s dashboard and give respective passwords (leave blank if no password).

ios step 8

Email (Amazon SES)

1. If you haven’t already got one, create a free AWS account and activate it by following these steps. And then go to your AWS Console and click Identity & Access Management or select IAM from Services dropdown

Email step ses iam

2. Click Users in the sidebar and then click on Create New Users button:

Email step ses create-new-users

3. Enter pushchamp as a username and click Create (leaving the checkbox ticked).

Email step ses create-user

4. Click Show User Security Credentials

Email step ses credentials

5. Close your credentials and confirm that you don’t want to download them.You should now see the user that you just created in the users table. Click on pushchamp (the username, not the checkbox):

Email step ses click-user

6. Go to Permissions tab.

Email step ses permission-tab

7. Expand Inline Policies by clicking on it. Then click on the click here link. Email step ses inline-policy

8. Choose Custom Policy and click Select. Email step ses select-custom-policy

9. Enter pushchamp-policy as the Policy Name, then copy and paste the following into the Policy Document.

{
    "Version": "2012-10-17",
     "Statement": [
             {
                 "Effect": "Allow",
                 "Action": [
                     "ses:*",
                     "sns:CreateTopic",
                     "sns:GetTopicAttributes",
                     "sns:Subscribe"
                 ],
                 "Resource": [
                     "*"
                 ]
             }
         ]
 }

This gives us permission to use SES (for your emails) and SNS (for bounces and complaints).

10. It should now look like this. Finally, click the Apply Policy button.

Email step ses apply-policy

11. AWS does not immediately grant unlimited Amazon SES usage to new users. New users are initially placed in the Amazon SES sandbox.To move out of sandbox, just follow these steps and then continue.

Email step ses moving-out-of-box


APIs

Send Notification

You can send Email, SMS, web push notification, mobile push notification in a single request. Just add these platforms and their respective values inside ‘address’ parameter.

Using registration ID
POST/send/

Send notification using address (Ex: registration ID returned by GCM for Android/Chrome, push notification tokens by APNS for iOS/Safari, Email id for emails, mobile numbers for SMS).

Example URI

POST /send/
Request  Android
HideShow
Headers
Content-Type: application/json
token: <API Token>
Body
{
    "template_vars": {
        "variable_key": "value"
    },                                  // You need to pass template variables you declared in template.
    "address": {
        "android": {
            "registration_ids": ["dBwsD0pfLB0:APA91bHsyrIz8ApvW5gtt6VWeA0gNoeO1HvdAfhjTMDD . ."]
        }
    },                                  // address field contains addresses for different platforms.
    "template_name": "template_name",   // Compulsory, you need to send template name.
    "name": "test"                      // Compulsory, Any name you want to associate this request with.
}
Request  iOS
HideShow
Headers
Content-Type: application/json
token: <API Token>
Body
{
    "template_vars": {
        "variable_key": "value"
    },                                  // You need to pass template variables you declared in template.
    "address": {
        "ios": {
            "device_tokens": ["kjdsnkfji43yy4hfkejsnfshdkj…"]
        }
    },                                  // address field contains addresses for different platforms.
    "template_name": "template_name",   // Compulsory, you need to send template name.
    "name": "test"                      // Compulsory, Any name you want to associate this request with.
}
Request  Android+iOS
HideShow
Headers
Content-Type: application/json
token: <API Token>
Body
{
  "template_vars": {
    "variable_key": "value"
  },
  "address": {
    "ios": {
      "device_tokens": [
        "kjdsnkfji43yy4hfkejsnfshdkj…"
      ]
    },
    "android": {
      "registration_ids": [
        "dBwsD0pfLB0:APA91bHsyrIz8ApvW5gtt6VWeA0gNoeO1HvdAfhjTMDD_…"
      ]
    }
  },
  "template_name": "<template_name>",
  "name": "test"
}
Request  SMS+Android+Email
HideShow
Headers
Content-Type: application/json
token: <API Token>
Body
{
    "template_vars": {
        "variable_key": "value"
    },
    "address": {
        "sms": {
            "mobiles": ["9999999999"]
        },                              // 'mobiles' should have an array of valid mobile numbers.
        "email": {
            "to": ["<emailid>"],        // Compulsory.
            "from": "<emailid>",        // Optional. Default is the one given while adding application.
            "cc": [],                   // Optional
            "bcc": []                   // Optional
        },
        "android": {
            "registration_ids": ["dBwsD0pfLB0:APA91bHsyrIz8ApvW5gtt6VWeA0gNoeO1HvdAfhjTMDD_…"]
        }
    },
    "template_name": "<template_name>",
    "name": "test"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
    "data": {
        "request_id": "13472ff8-aa11-11e5-bce6-06734ed5c691",   // unique id for this request.
        "totalAddress": {
            "ios": 1,
            "chrome": 10,
            "sms": 20
        }               // This JSON tells how many addresses for each requested platform has been found for this address.
    },
    "error": "",        // empty string if 'status' is true.
    "status": true      // true if request is successful, false otherwise.
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
    "status": false,
    "error": "some error for this request.",
    "data": Null
}

Using Tags
POST/send/

Send notification using using custom tags. Tags are key-value pairs which you can assign to your subscriptions. Ex: {“email”: "shailesh.iiita@gmail.com“}, {“mobile”: “1234567890”}, {user_id”: “a765764de87687”}, etc

Example URI

POST /send/
Request  Chrome+Safari
HideShow
Headers
Content-Type: application/json
token: <API Token>
Body
{
  "template_vars": {
    "variable_key": "value"
  },
  "address": {
    "chrome": {
      "tags": [
        {
          "email": "useremail@domain.com"
        }
      ]
    },
    "safari": {
      "tags": [
        {
          "mobile": "234567ade456798"
        }
      ]
    }
  },
  "template_name": "<template_name>",
  "name": "test"
}
Request  Android+iOS
HideShow
Headers
Content-Type: application/json
token: <API Token>
Body
{
  "template_vars": {
    "variable_key": "value"
  },
  "address": {
    "android": {
      "tags": [
        {
          "email": "useremail@domain.com"
        }
      ]
    },
    "ios": {
      "tags": [
        {
          "email": "useremail@domain.com"
        }
      ]
    }
  },
  "template_name": "<template_name>",
  "name": "test"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "data": {
    "request_id": "13472ff8-aa11-11e5-bce6-06734ed5c691",
    "totalAddress": {
      "ios": 1,
      "chrome": 10,
      "sms": 20
    }
  },
  "error": "",
  "status": true
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
    "status": false,
    "error": "Unauthorized request.",
    "data": Null
}

Using Filters
POST/send/

Send notifications using multiple filters like groups, user sessions, active users, etc.

Example URI

POST /send/
Request  Chrome+Safari
HideShow
Headers
Content-Type: application/json
token: <API Token>
Body
{
  "template_vars": {
    "variable_key": "value"
  },
  "address": {
    "chrome": {
      "filters": {
        "grp": [
          "all"
        ]
      }
    },
    "safari": {
      "filters": {
        "grp": [
          "registered",
          "demo_tried"
        ]
      }
    }
  },
  "template_name": "<template_name>",
  "name": "test"
}
Request  Android+Safari
HideShow
Headers
Content-Type: application/json
token: <API Token>
Body
{
  "template_vars": {
    "variable_key": "value"
  },
  "address": {
    "android": {
      "filters": {
        "grp": [
          "all"
        ]
      }
    },
    "safari": {
      "filters": {
        "grp": [
          "all"
        ]
      }
    }
  },
  "template_name": "<template_name>",
  "name": "test"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "data": {
    "request_id": "13472ff8-aa11-11e5-bce6-06734ed5c691",
    "totalAddress": {
      "ios": 1,
      "chrome": 10,
      "sms": 20
    }
  },
  "error": "",
  "status": true
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
    "status": false,
    "error": "Unauthorized request",
    "data": Null
}

Subscription

This endpoint lets you subscribe your devices at PushChamp. You can also use this to update any tag/group or any other information to any particular subscription.

Create user
POST/subscribe/

Example URI

POST /subscribe/
Request  Web/Mobile/SMS/Email
HideShow
Headers
Content-Type: application/json
token: <API Token>
Body
{
    "platform": "chrome",
    "notification_token": "7endow8hd739kdjshy79dms03jnagiimkdmvnauii823932ie89ncr38nc9yccn92xxxxxxxx",
    "hardware_id": <hardware_id of device>,
    "status": "installed",
    "mobile": "1234567890",
    "email": "email@domain.com",
    "unique_id": "13476978abe576567",
    "other": {
        "city": "Bangalore",
        "country": "India",
        "seller-type" : "big deals"
    },
    "add_tags": [
        {
            "key": "key1",
            "value": "value1",
        },
        {
            "key": "key2",
            "value": "value2",
        }
    ],
    "add_groups": ["premium_user", "email_verified"],
    "browser_enc_keys": {
        "keys": {
            "p256dh": "string",
            "auth": "string"
        }
    }
}
Schema
platform : (string)(compulsory) Platform for subscripiton. ex: android, ios, firefox, safari, chrome, sms, email
notification_token : (string)(compulsory) Valid address for respective platform. Ex: Valid mobile number with country code for 'sms', Valid email id for 'email', Valid push notification token for ios/safari, valid registration id for android/chrome/firefox, etc.
hardware_id: (optional) hardware id of the device, on which subscription happened.
status: (string)(optional) Status of user. "installed" or "uninstalled". Default value is 'installed'.
mobile: (string)(optional) Mobile number linked with subscription.
email: (string)(optional) Email id linked with subscription.
uniquer_id: (string)(optional) An id, you use to track your users uniquely.
other: (dictionary)(optional) Link device information like:
        {
            "city": "mumbai",
            "country": "india",
            "model no": "Y5010XXX",
            "android version": "6.0",
        }
add_tag: (array of dictonary)(optional) Custom tags linked with subscription.
add_groups: (array of string)(optional) Groups, you want to add this subscription into.
browser_enc_keys: (optional) p256dh and auth key for browser subscription (firefox and chrome).
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "status": true,
  "error": "string",
  "data": {
    "subscription_id": "d124d5d43drs23124"
  }
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
    "status": false,
    "error": "Unauthorized request",
    "data": Null
}
Schema
status : (boolean) true if request has been successful, false otherwise.
error : (string) non-empty error message for false 'status'.
data : You will receiver a subscription_id for subscriber for true 'status'. You can use this id to update this subscription later.

Update user
POST/subscribe/

To update details of subscriber, you need to provide either notification_token or subscription_id.

Example URI

POST /subscribe/
Request  Web/Mobile/SMS/Email
HideShow
Headers
Content-Type: application/json
token: <API Token>
Body
{
  "notification_token": "string",
  "subscription_id": "d124d5d43drs23124",
  "hardware_id": "<hardware_id of subscription device>",
  "status": "installed",
  "mobile": "string",
  "email": "string",
  "unique_id": "string",
  "other": {
    "seller-type": "big deals"
  },
  "add_tags": [
    {
      "key": "key3",
      "value": "value3"
    }
  ],
  "delete_tags": [
    "key1"
  ],
  "add_groups": [
    "demo user"
  ],
  "delete_groups": [
    "primium_user"
  ],
  "browser_enc_keys": {
    "keys": {
      "p256dh": "string",
      "auth": "string"
    }
  }
}
Schema
platform : (string)(compulsory) Platform for subscripiton. ex: android, ios, firefox, safari, chrome, sms, email
notification_token : (string)
    Valid address for respective platform.
    Ex: Valid mobile number with country code for 'sms',
        Valid email id for 'email',
        Valid push notification token for ios/safari,
        Valid registration id for android/chrome/firefox, etc.
subscription_id : (string)
    For new subscription null (optional), you will receive a subscription_id for a vaild subscription request
    For exiting subscriber user use subscription_id to delete or update details
hardware_id: (optional) hardware id of the device, on which subscription happened.
status: (string)(optional) Status of user. "installed" or "uninstalled". Default value is 'installed'.
mobile: (string)(optional) Mobile number linked with subscription.
email: (string)(optional) Email id linked with subscription.
uniquer_id: (string)(optional) An id, you use to track your users uniquely.
other: (dictionary)(optional) Link device information like:
        {
            "city": "mumbai",
            "country": "india",
            "model no": "Y5010XXX",
            "android version": "6.0",
        }
add_tag: (array of dictonary)(optional) Custom tags linked with subscription.
delete_tag: (array of string) List of tags to be deleted for subscription.
add_groups: (array of string)(optional) Groups, you want to add this subscription into.
delete_groups: (array of string) List of groups to be deleted for subscription.
browser_enc_keys: (optional) p256dh and auth key for browser subscription (firefox and chrome).
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "status": true,
  "error": "string",
  "data": {
    "subscription_id": "d124d5d43drs23124"
  }
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
    "status": false,
    "error": "some error ",
    "data": Null
}

Track Notifications

This endpoint lets you track events your API requests at PushChamp. You can track any event status using this API.

Track Notifications
POST/getstatus/

Example URI

POST /getstatus/
Request  Email+SMS+Mobile+Browser
HideShow
Headers
Content-Type: application/json
token: <API Token> // PushChamp server token (from dashboard/keys/ page.)
Body
{
    "request_id" : "13472ff8-aa11-11e5-bce6-06734ed5c691",      // Request id for a particular notification request you want to track.
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
    "status": true,   // true if your request id is valid, false otherwise.
    "error": "",      // An error string if status is false.
    "data": {}        // JSON data for given request id if status is true otherwise None.
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
    "status": false,                    // true if your request id is valid, false otherwise.
    "error": "unauthorized request",    // An error string if status is false.
    "data": Null                        // JSON data for given request id if status is true otherwise None.
}

Segment Integration

Configuration

If you haven’t already got one, create a free Segment account and create a new workspace by following these steps. Once you are done with your segment account running and your events are coming to segment, follow the below steps to connect your PushChamp account to your segment account.

1. Select a segment workspace to connect that with PushChamp. Go here.

Select your segment workspace

2. Switch to Sources tab on top and select a source from the list. Or more precisely, go here(with appropriate your-workspace and your-source values.): "https://segment.com/your-workspace/sources/your-source/overview"

Select your segment source

3. Now switch to Integrations page and search for webhooks.

Choose webhooks from segment integration

4. *Add a webhook from Connection Settings. To do this, click Add Another hook and then fill Webhook URL and 2 header as follows:

Put Webhook URL as "http://api.pushchamp.com/v1/segment/".

Put 1st header row as “Content-Type: application/json”

Put 2nd row as “token: Your-pushchamp-server-token”. You can get your pushchamp token from here.

Now Save this Webhooks and then Activate Integration from top right corner.

You are done with Segment-PushChamp integration now.

Add a segment webhook

Generated by aglio on 02 Feb 2017