VBScript / Braze Endpoints / List User's Subscription Group Status - Email
Back to Collection Items
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Http")
set http = CreateObject("Chilkat.Http")
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set queryParams = CreateObject("Chilkat.JsonObject")
success = queryParams.UpdateString("subscription_group_id","{{subscription_group_id}}")
success = queryParams.UpdateString("external_id","{{external_identifier}}")
success = queryParams.UpdateString("email","example@braze.com")
' Adds the "Authorization: Bearer {{api_key}}" header.
http.AuthToken = "{{api_key}}"
' resp is a Chilkat.HttpResponse
Set resp = http.QuickRequestParams("GET","https://rest.iad-01.braze.com/subscription/status/get",queryParams)
If (http.LastMethodSuccess = 0) Then
outFile.WriteLine(http.LastErrorText)
WScript.Quit
End If
outFile.WriteLine(resp.StatusCode)
outFile.WriteLine(resp.BodyStr)
outFile.Close
Curl Command
curl -G -d "subscription_group_id=%7B%7Bsubscription_group_id%7D%7D"
-d "external_id=%7B%7Bexternal_identifier%7D%7D"
-d "email=example%40braze.com"
-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 - Email",
"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}}&email=example@braze.com",
"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 email is accepted for email subscription groups"
},
{
"key": "email",
"value": "example@braze.com",
"description": "(Required* ) String\n\nThe email address of the user. Can be passed as an array of string with a max of 50.\n\nOnly external_id or email is accepted for email subscription groups"
}
]
},
"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": [
]
}