Node.js / Braze Endpoints / List User's Subscription Group Status - SMS
Back to Collection Items
var os = require('os');
if (os.platform() == 'win32') {
if (os.arch() == 'ia32') {
var chilkat = require('@chilkat/ck-node21-win-ia32');
} else {
var chilkat = require('@chilkat/ck-node21-win64');
}
} else if (os.platform() == 'linux') {
if (os.arch() == 'arm') {
var chilkat = require('@chilkat/ck-node21-arm');
} else if (os.arch() == 'x86') {
var chilkat = require('@chilkat/ck-node21-linux32');
} else {
var chilkat = require('@chilkat/ck-node21-linux64');
}
} else if (os.platform() == 'darwin') {
if (os.arch() == 'arm64') {
var chilkat = require('@chilkat/ck-node21-mac-m1');
} else {
var chilkat = require('@chilkat/ck-node21-macosx');
}
}
function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var http = new chilkat.Http();
var success;
var queryParams = new chilkat.JsonObject();
queryParams.UpdateString("subscription_group_id","{{subscription_group_id}}");
queryParams.UpdateString("external_id","{{external_identifier}}");
queryParams.UpdateString("phone"," 11112223333");
// Adds the "Authorization: Bearer {{api_key}}" header.
http.AuthToken = "{{api_key}}";
// resp: HttpResponse
var resp = http.QuickRequestParams("GET","https://rest.iad-01.braze.com/subscription/status/get",queryParams);
if (http.LastMethodSuccess == false) {
console.log(http.LastErrorText);
return;
}
console.log(resp.StatusCode);
console.log(resp.BodyStr);
}
chilkatExample();
Curl Command
curl -G -d "subscription_group_id=%7B%7Bsubscription_group_id%7D%7D"
-d "external_id=%7B%7Bexternal_identifier%7D%7D"
-d "phone=%2011112223333"
-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/subscription/status/get
Postman Collection Item JSON
{
"name": "List User's Subscription Group Status - SMS",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{api_key}}",
"type": "text"
}
],
"url": {
"raw": "https://{{instance_url}}/subscription/status/get?subscription_group_id={{subscription_group_id}}&external_id={{external_identifier}}&phone=+11112223333",
"protocol": "https",
"host": [
"{{instance_url}}"
],
"path": [
"subscription",
"status",
"get"
],
"query": [
{
"key": "subscription_group_id",
"value": "{{subscription_group_id}}",
"description": "(Required) String\n\nThe `id` of your subscription group."
},
{
"key": "external_id",
"value": "{{external_identifier}}",
"description": "(Required*) String\n\nThe `external_id` of the user (must include at least one and at most 50 `external_ids`).\n\nOnly external_id or phone is accepted for SMS subscription groups\n"
},
{
"key": "phone",
"value": "+11112223333",
"description": "(Required*) String\n\nThe phone number of the user (must include at least one phone number and at most 50 phone numbers). The recommendation is to provide this in the E.164 format.\n\nOnly external_id or phone is accepted for SMS subscription groups\n"
}
]
},
"description": "Use the endpoint below to get the subscription state of a user in a subscription group. The response from this endpoint will include the external ID and either subscribed, unsubscribed, or unknown for the specific subscription group requested in the API call. This can be used to update the subscription group state in subsequent API calls or to be displayed on a hosted web page.\n\n> *Either `external_id` or `email` are required.\n\n## Response\n\nAll successful responses will return `subscribed`, `unsubscribed`, or `unknown` depending on status and user history with the subscription group.\n\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR-REST-API-KEY\n{\n \"status\": {\n \"1\": \"Unsubscribed\",\n \"2\": \"Subscribed\"\n },\n \"message\": \"success\"\n}\n```"
},
"response": [
]
}