BrazeEx.Api.SubscriptionGroupsSMSAndWhatsApp (braze_ex v1.0.22)

API calls for all endpoints tagged SubscriptionGroupsSMSAndWhatsApp.

Link to this section Summary

Functions

List User's Subscription Group Status - SMS

Use this endpoint to get the subscription state of a user in a subscription group.

Update User's Subscription Group Status - SMS

Use this endpoint to batch update the subscription state of up to 50 users on the Braze dashboard.

List User's Subscription Group - SMS

Use this endpoint to list and get the subscription groups of a certain user.

Update User's Subscription Group Status V2

Use this endpoint to batch update the subscription state of up to 50 users on the Braze dashboard.

Link to this section Functions

Link to this function

subscription_status_get_get(connection, opts \\ [])

@spec subscription_status_get_get(
  Tesla.Env.client(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

list-user-s-subscription-group-status-sms

List User's Subscription Group Status - SMS

Use this endpoint to get the subscription state of a user in a subscription group.

To use this endpoint, you’ll need to generate an API key with the subscription.status.get permission.

These groups will be available on the Subscription Group page. 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.

*Either external_id or phone are required. When both are submitted, only the external_id is used for querying and the phone number is applied to that user.

rate-limit

Rate limit

We apply the default Braze rate limit of 250,000 requests per hour to this endpoint, as documented in API rate limits.

response

Response

All successful responses will return subscribed, unsubscribed, or unknown depending on status and user history with the subscription group.

Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
{
"status": {
  "1": "Unsubscribed",
  "2": "Subscribed"
},
"message": "success"
}

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :Authorization (String.t):
    • :subscription_group_id (String.t): (Required) String The id of your subscription group.
    • :external_id (String.t): (Required*) String The external_id of the user (must include at least one and at most 50 external_ids). When both an external_id and phone are submitted, only the external_id(s) provided will be applied to the result query.
    • :phone (float()): (Required*) String in E.164 format The phone number of the user (must include at least one phone number and at most 50 phone numbers).

returns

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

subscription_status_set_post(connection, opts \\ [])

@spec subscription_status_set_post(
  Tesla.Env.client(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

update-user-s-subscription-group-status-sms

Update User's Subscription Group Status - SMS

Use this endpoint to batch update the subscription state of up to 50 users on the Braze dashboard.

To use this endpoint, you’ll need to generate an API key with the subscription.status.set permission.

You can access a subscription group’s subscription_group_id by navigating to the Subscription Group page.

Tip: When creating new users via the /users/track endpoint, you can set subscription groups within the user attributes object, which allows you to create a user and set the subscription group state in one API call.

*Only external_id or phone is accepted for SMS subscription groups.

rate-limit

Rate limit

For customers who onboarded with Braze on or after January 6, 2022, we apply a rate limit of 5,000 requests per minute shared across the /subscription/status/set and /v2/subscription/status/set endpoint as documented in API rate limits.

request-parameters

Request parameters

ParameterRequiredData TypeDescription
subscription_group_idRequiredStringThe id of your subscription group.
subscription_stateRequiredStringAvailable values are unsubscribed (not in subscription group) or subscribed (in subscription group).
external_idRequired*Array of stringsThe external_id of the user or users, may include up to 50 ids.
phoneRequired*String in E.164 formatThe phone number of the user, can be passed as an array of strings. Must include at least one phone number (with a max of 50).

example-successful-response

Example successful response

The status code 201 could return the following response body.

{
  "message": "success"
}

Important: The endpoint only accepts the email or phone value, not both. If given both, you will receive this response: {"message":"Either an email address or a phone number should be provided, but not both."}

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :"Content-Type" (String.t):
    • :Authorization (String.t):
    • :body (String.t):

returns

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

subscription_user_status_get(connection, opts \\ [])

@spec subscription_user_status_get(
  Tesla.Env.client(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

list-user-s-subscription-group-sms

List User's Subscription Group - SMS

Use this endpoint to list and get the subscription groups of a certain user.

To use this endpoint, you’ll need to generate an API key with the subscription.groups.get permission.

If there are multiple users (multiple external IDs) who share the same email address, all users will be returned as a separate user (even if they have the same email address or subscription group).

rate-limit

Rate limit

We apply the default Braze rate limit of 250,000 requests per hour to this endpoint, as documented in API rate limits.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :Authorization (String.t):
    • :external_id (String.t): (Required*) String The external_id of the user (must include at least one and at most 50 external_ids).
    • :limit (integer()): (Optional) Integer The limit on the maximum number of results returned. Default (and max) limit is 100.
    • :offset (integer()): (Optional) Integer Number of templates to skip before returning the rest of the templates that fit the search criteria.
    • :phone (float()): (Required*) String in E.164 format The phone number of the user. Must include at least one phone number (with a max of 50).

returns

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

v2_subscription_status_set_post(connection, opts \\ [])

@spec v2_subscription_status_set_post(
  Tesla.Env.client(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

update-user-s-subscription-group-status-v2

Update User's Subscription Group Status V2

Use this endpoint to batch update the subscription state of up to 50 users on the Braze dashboard.

To use this endpoint, you’ll need to generate an API key with the subscription.status.set permission.

You can access a subscription group’s subscription_group_id by navigating to the Subscriptions Group page.

rate-limit

Rate limit

For customers who onboarded with Braze on or after January 6, 2022, we apply a rate limit of 5,000 requests per minute shared across the /subscription/status/set and /v2/subscription/status/set endpoint as documented in API rate limits.

request-parameters

Request parameters

ParameterRequiredData TypeDescription
subscription_group_idRequiredStringThe id of your subscription group.
subscription_stateRequiredStringAvailable values are unsubscribed (not in subscription group) or subscribed (in subscription group).
external_idsRequired*Array of stringsThe external_id of the user or users, may include up to 50 ids.
phonesRequired*String in E.164 formatThe phone numbers of the user, can be passed as an array of strings. Must include at least one phone number (with a max of 50).

example-successful-response

Example successful response

Response: (status 201)

{
  "message": "success"
}

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :"Content-Type" (String.t):
    • :Authorization (String.t):
    • :body (String.t):

returns

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure