For managing the SDK push notifications, the platform provides the following APIs:
Device Subscription API
This API manages SDK push message subscriptions for a user’s specified device. It performs two main functions:
- Subscribes the device to SDK push messages.
- Returns subscription status and device details.
Method |
POST |
Endpoint |
https://{host}/API/public/streams/:{{streamId}}/sdknotifications/subscribe |
Content Type |
application/json |
Authorization |
auth: {{JWT}}
See How to generate the JWT Token. |
API Scope |
- Bot Builder: SDKPushNotifications
- Admin Console: Not Applicable
|
Sample Request
curl --location
'https://{{host}}/api/public/stream/:{{streamId}}/sdknotifications/subscribe' \
--header 'auth: {jwt-token}' \
--header 'bot-language: {language-code}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceId": "exxxxxf0-bxx3-4xx3-axx7-fexxxxxxxxxx2",
"osType": "Android",
"userId": "u-dxxxxxx1-7xx0-5xxb-axx2-84xxxxxxxxx2"
}'
Sample Response
{
"success": true,
"message": "Device Subscribed",
"deviceDetails": {
"deviceId": "exxxxxf0-bxx3-4xx3-axx7-fexxxxxxxxxx2",
"osType": "Android",
"status": "Subscribed"
}
}
Subscribed User Devices API
This API lists all the mobile devices subscribed to SDK push notifications and their OS types for the given user. It returns the following information:
- Device ID
- OS Type
- Subscription Status
Method |
GET |
Endpoint |
https://{host}/API/public/streams/:{{streamId}}/subscribeddevices |
Content Type |
application/json |
Authorization |
auth: {{JWT}}
See How to generate the JWT Token. |
API Scope |
- Bot Builder: SDKPushNotifications
- Admin Console: Not Applicable
|
Sample Request
curl --location
'https://{{host}}/api/public/streams/:{{streamId}}/subscribeddevices?uId=-f30xxx4e-6xx3-5xx8-8xx7-01xxxxxxxxx4u' \
--header 'auth: {jwt-token}' \
--header 'bot-language: {language-code}' \
--header 'Content-Type: application/json' \
--data-raw '{
}'
Sample Response
{
"subscribedDevices": [
{
"deviceId": "exxxxxf0-bxx3-4xx3-axx7-fexxxxxxxxxx2",
"osType": "Android",
"status": "Subscribed"
},
{
"deviceId": "exxxxxx0-bxx3-4xx3-axx7-fxxxxxxxxxxf",
"osType": "ios",
"status": "Subscribed"
}
]
}
Device Unsubscription API
This API unsubscribes SDK push messages for specific or all the devices of a user.
Unsubscribe Specific Devices
This API returns the device ID, OS type, and the subscription status (unsubscribed) for the selected devices.
Sample Request
curl --location
'https://{{host}}/api/public/streams/:{{streamId}}/sdknotifications/unsubscribe' \
--header 'auth: {jwt-token}' \
--header 'bot-language: {language-code}' \
--header 'Content-Type: application/json' \
--data-raw '{
"devices":
[
{ "deviceId": "exxxxxx0-bxx3-4xx3-axx7-fxxxxxxxxxxf", "osType": "iOS" },
{ "deviceId": "exxxxxx1-bxx5-5xx3-axx2-bxxxxxxxxxxf", "osType": "Android" }
],
"userId": "u-fxxxxxxe-6xx3-5xx8-8xx7-0xxxxxxxxxx4"
}'
Sample Response
{
"success": true,
"message": "Requested devices are Unsubscribed",
"unsubscribedDevices": [
{
"deviceId": "exxxxxx0-bxx3-4xx3-axx7-fxxxxxxxxxxf",
"osType": "iOS",
"status": "unsubscribed"
},
{
"deviceId": "exxxxxx1-bxx5-5xx3-axx2-bxxxxxxxxxxf",
"osType": "Android",
"status": "unsubscribed"
}
],
"invalidDeviceIds": [
{
"deviceId": "Prod Iphone5rs"
}
]
}
Unsubscribe All the Devices
This API returns the success status and message when all the devices are unsubscribed.
Sample Request
curl --location
'https://{{host}}/api/public/streams/:{{streamId}}/sdknotifications/unsubscribe' \
--header 'auth: {jwt-token}' \
--header 'bot-language: {language-code}' \
--header 'Content-Type: application/json' \
--data-raw '{
"unsubscribe": "all",
"userId": "u-fxxxxxxe-6b83-56d8-8397-011c430550a4"
}'
Sample Response
{
"success": true,
"message": "All Devices are unsubscribed"
}