Chilkat Online Tools

PowerBuilder / Braze Endpoints / List User's Subscription Group Status - SMS

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_QueryParams = create oleobject
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_QueryParams.UpdateString("subscription_group_id","{{subscription_group_id}}")
loo_QueryParams.UpdateString("external_id","{{external_identifier}}")
loo_QueryParams.UpdateString("phone"," 11112223333")

// Adds the "Authorization: Bearer {{api_key}}" header.
loo_Http.AuthToken = "{{api_key}}"

loo_Resp = loo_Http.QuickRequestParams("GET","https://rest.iad-01.braze.com/subscription/status/get",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_QueryParams
    return
end if

Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp


destroy loo_Http
destroy loo_QueryParams

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": [
  ]
}