ユーザーのサブスクリプション グループの状態を更新する (V2)
/v2/subscription/status/set
このエンドポイントを使用して、Brazeダッシュボードで最大50人のユーザーのサブスクリプション状態を一括更新します。
サブスクリプション グループ subscription_group_id にアクセスするには、[ サブスクリプション グループ ] ページに移動します。
例を参照したり、このエンドポイントを メールサブスクリプショングループでテストしたりする場合は、次のようにします。
SMS サブスクリプション グループについてこのエンドポイントの例を参照またはテストする場合は、次のようにします。
WhatsApp Groupsでこのエンドポイントの例を確認したり、テストしたりする場合は、次のようにします。
前提条件
このエンドポイントを使用するには、アクセス許可を持つ subscription.status.set API キーが必要です。
レート制限
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.
リクエスト本文
1
2
Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
1
2
3
4
5
6
7
8
9
10
11
{
  "subscription_groups":[
    {
      "subscription_group_id": (required, string),
      "subscription_state": (required, string)
      "external_ids": (required*, array of strings),
      "emails": (required*, array of strings),
      "phones": (required*, array of strings in E.164 format),
    }
  ]
}
* とphonesパラメータの両方emailsを含めることはできませんのでご注意ください。また、emails、 phonesexternal_ids
エンドポイントを介して/users/track新しいユーザーを作成する場合、ユーザー属性オブジェクト内にサブスクリプション グループを設定できるため、1 回の API 呼び出しでユーザーを作成し、サブスクリプション グループの状態を設定できます。
要求パラメーター
| パラメータ | 必須項目 | データ型 | 説明 | |
|---|---|---|---|---|
subscription_group_id | 
      必須項目 | 文字列 | サブスクリプション グループの | id | 
    
subscription_state | 
      必須項目 | 文字列 | 使用可能な値は、(サブスクリプション グループ内にない) または (サブスクリプション グループ内) です unsubscribed subscribed 。 | 
      |
external_ids | 
      必須項目* | 文字列の配列 | ユーザー external_id またはユーザーの、最大50 id秒を含み得る。 | 
      |
emails | 
      必須項目* | 文字列または文字列の配列 | ユーザーのメールアドレスは、文字列の配列として渡すことができます。少なくとも 1 つのメール アドレス (最大 50 個) を含める必要があります。 同じワークスペース内の複数のユーザー () external_id が同じメール アドレスを共有している場合、メール アドレスを共有するすべてのユーザーは、サブスクリプション グループの変更で更新されます。 | 
      |
phones | 
      必須項目* | E.164 形式の文字列 | ユーザーの電話番号は、文字列の配列として渡すことができます。少なくとも 1 つの電話番号 (最大 50 個) を含める必要があります。 | 
パラメーターphonesとパラメーターの両方emailsを含めることはできません。また、emails、 phonesexternal_ids
要求の例
次の例では、を使用して external_id 、メールと SMS の API 呼び出しを 1 回行います。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
curl --location --request POST 'https://rest.iad-01.braze.com/v2/subscription/status/set' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
  "subscription_groups":[
    {
      "subscription_group_id":"subscription_group_identifier",
      "subscription_state":"subscribed",
      "external_ids":["example-user","example1@email.com"]
    },
    {
      "subscription_group_id":"subscription_group_identifier",
      "subscription_state":"subscribed",
      "external_ids":["example-user","example1@email.com"]
    }
  ]
}
メール
1
2
3
4
5
6
7
8
9
10
11
12
13
curl --location --request POST 'https://rest.iad-01.braze.com/v2/subscription/status/set' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
  "subscription_groups":[
    {
      "subscription_group_id":"subscription_group_identifier",
      "subscription_state":"subscribed",
      "emails":["example1@email.com","example2@email.com"]
    }
  ]
}
'
SMSとWhatsApp
1
2
3
4
5
6
7
8
9
10
11
12
13
curl --location --request POST 'https://rest.iad-01.braze.com/v2/subscription/status/set' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
  "subscription_groups":[
    {
      "subscription_group_id":"subscription_group_identifier",
      "subscription_state":"subscribed",
      "phones":["+12223334444","+15556667777"]
    }
  ]
}
'
   Edit this page on GitHub