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
Content-Type
string
application/json
Request Body
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
{
"success": true,
"data": {
"user": {
"id": "6022d697eb895132d430a803",
"userId": "test2081",
"gluId": "d6aeadf1-7131-4bb9-8c67-e3b003683b1f",
"userName": "Test User 2077",
"email": "[email protected]",
"phone": "977777252222",
"cookieId": "asdhbfkjsdv",
"appVersion": "1.0.3",
"client": "c27ecb52-0f00-443e-8dfe-01585b426ca7",
"referralLink": null,
"referredBy": "testuser36",
"customAttributes": {
"guruLevel": 2
},
"profile": {
"age": "29",
"city": "Bangalore",
"country": "India",
"timezone": "America/Los_Angeles"
},
"identities": {
"facebook_id": "asdf",
"google_id": "asdf",
"android_id": "asdf",
"ios_id": "asdf",
"clevertap_id": "asdfa",
"mparticle_id": "asdfasdf",
"segment_id": "asdf",
"moengage_id": "asdf"
},
"sessionId": "tempSessionId",
"deviceId": "xampT",
"deviceType": "ios",
"deviceName": "Samsung Note 07"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ0ZXN0MjA4MSIsImdsdUlkIjoiZDZhZWFkZjEtNzEzMS00YmI5LThjNjctZTNiMDAzNjgzYjFmIiwiY2xpZW50IjoiYzI3ZWNiNTItMGYwMC00NDNlLThkZmUtMDE1ODViNDI2Y2E3IiwiZGV2aWNlSWQiOiJ4YW1wVCIsImRldmljZVR5cGUiOiJpb3MiLCJpYXQiOjE2MTI4OTU4OTUsImV4cCI6MTY0NDQzMTg5NX0.bzW0HWbeI1hAIJN1xuuP5y3zUkzlSWn7fn6lDMxb_eM"
}
}
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
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
Authorization
string
Bearer <token> (jwt token retrieved from the response of Register API)
Content-Type
string
application/json
{
"success": true,
"defaultUrl": "https://customerglu-previews-2.vercel.app/quiz?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ0ZXN0MjUiLCJjbGllbnQiOiIxN2E5MjNhMS04NGJjLTQwZTYtYWFiZi03YTNkZWE4Nzg0MDEiLCJkZXZpY2VJZCI6ImRldmljZWIiLCJkZXZpY2VUeXBlIjoiYW5kcm9pZCIsImlhdCI6MTYxMDU2MjY0MSwiZXhwIjoxNjQyMDk4NjQxfQ.XDVk0T7GoFgYozj9J17L7LdYtaJbjhpL1DOmF3VPWBw",
"defaultBanner": {
"liveCampaignCount": 2,
"totalRewardCount": 0,
"unplayedGamesCount": 1,
"liveChallengeCount": 0
},
"campaigns": [
{
"campaignId": "3b6a9735-7255-4d38-b186-861b185d22a7",
"url": "https://customerglu-xyz.com",
"type": "quiz",
"status": "clicked",
"banner": {
"title": "Food Trivia",
"body": "Answer these questions based on cuisines from around the world to win rewards",
"image": "https://customerglu.com/assets/food.png"
}
},
{
"campaignId": "8eaf889d-e806-4fef-953e-419f1c620ad8",
"url": "https://customerglu-abc.com",
"type": "activityProgram",
"status": "in-progress",
"banner": {
"title": "First 100",
"body": "Get $100 on completing all tasks.",
"image": "https://customerglu.com/assets/first-100.png"
}
}
]
}
Last updated
Was this helpful?