Integrating with APIs
Achieving the desired custom tailored use-case by calling CustomerGlu APIs and coding out the logic at your end...
1. Register Device/User
The following API can be used to register as well as update the attributes of a user:
Register a device
POST
https://api.customerglu.com/user/v1/user/sdk?token=true
Every single user must first be registered with CustomerGlu to create segments, run campaigns and report.
To register/update a device/user (Eg: Can be called during user sign up, app Install, firebase token refresh etc)
Returns a JWT token in response
The token needs to be passed in all the subsequent API calls
To be called on firebase/APNS token refresh to update the token. Custom user attributes can be registered/updated by using customAttributes
object.
Headers
Name | Type | Description |
---|---|---|
Content-Type | string | application/json |
Request Body
Name | Type | Description |
---|---|---|
userId* | string | |
writeKey* | string | Write key provided by CustomerGlu |
anonymousId | string | |
userName | string | |
string | ||
phone | string | |
deviceId | string | |
deviceType | string | Accepted values: android/ios/default |
deviceName | string | |
firebaseToken | string | Firebase token for enabling push notification |
cookieId | string | |
appVersion | string | |
referredBy | string | Id of the referred user (referral programs) |
customAttributes | object | Custom key-value pair. Can be used for segmentation |
profile | object | |
profile.age | string | |
profile.city | string | |
profile.country | string | |
profile.timezone | string | |
identities | object | |
identities.facebook_id | string | |
identities.google_id | string | |
identities.android_id | string | |
identities.ios_id | string | |
identities.clevertap_id | string | |
identities.mparticle_d | string | |
identities.segment_id | string | |
identities.moengage_id | string | |
apnsDeviceToken | string | APNS token for enabling push notification |
2. Fetching all Campaigns and Wallet URLs
The following API can be used to fetch the wallet url, and the urls, status information of individual campaigns available for a user:
Load Campaigns
GET
https://api.customerglu.com/reward/v1.1/user
To fetch all the ongoing campaigns that can be used to create banners or load the program UI using URLs. The response can be filtered using query params like: status: [pristine, clicked, completed] type: [memorygame, referral, slotmachine, spinthewheel, quiz, streak, multistep] Following properties from response object can be used based on the user story defaultUrl: the URL for CustomerGlu wallet page which contains all the ongoing campaigns and rewards
Query Parameters
Name | Type | Description |
---|---|---|
status | string | values can be [pristine,clicked,completed,in-progress] |
type | string | values can be any of these [spinthewheel,referral,quiz,slotmachine,memorygame,scratchcard, streak,multistep] |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer <token> (jwt token retrieved from the response of Register API) |
Content-Type | string | application/json |
Last updated