ユーザーのサブスクリプショングループステータスの更新
このエンドポイントを使用して、Brazeダッシュボード上で最大50ユーザーのサブスクリプション状態を一括更新します。
サブスクリプショングループのsubscription_group_idにアクセスするには、サブスクリプショングループページに移動します。
メールサブスクリプショングループの例を確認したり、このエンドポイントをテストしたりする場合:
SMSとRCSサブスクリプショングループの例を確認したり、このエンドポイントをテストしたりする場合:
前提条件
このエンドポイントを使用するには、subscription.status.set権限を持つAPIキーが必要です。
レート制限
このエンドポイントには、APIレート制限に記載されているように、/subscription/status/set と /v2/subscription/status/set エンドポイント間で共有される1分あたり5,000リクエストのレート制限があります。
リクエスト本文
1
2
Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
1
2
3
4
5
6
7
8
{
"subscription_group_id": (required, string) the id of your subscription group,
"subscription_state": (required, string) available values are "unsubscribed" (not in subscription group) or "subscribed" (in subscription group),
"external_id": (required*, array of strings) the external ID of the user or users, may include up to 50 IDs,
"phone": (required*, array of strings in E.164 format) The phone number of the user (must include at least one phone number and at most 50 phone numbers),
"use_double_opt_in_logic": (optional, boolean) defaults to `false`; when `subscription_state` is "subscribed", set to `true` to enter the user into the SMS double opt-in workflow,
// SMS and RCS subscription group - you must include one of external_id or phone
}
* SMSとRCSのサブスクリプショングループ: Brazeはexternal_idまたはphoneのみを受け付けます。
1
2
Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
1
2
3
4
5
6
7
8
{
"subscription_group_id": (required, string) the id of your subscription group,
"subscription_state": (required, string) available values are "unsubscribed" (not in subscription group) or "subscribed" (in subscription group),
"external_id": (required*, array of strings) the external ID of the user or users, may include up to 50 IDs,
"email": (required*, array of strings) the email address of the user (must include at least one email and at most 50 emails),
// Email subscription group - you must include one of external_id or email
// Note that sending an email address that is linked to multiple profiles updates all relevant profiles
}
* メールサブスクリプショングループ: emailまたはexternal_idのどちらかを含める必要があります。
このプロパティは、ユーザーのプロファイル情報の更新には使用しないでください。代わりに/users/trackプロパティを使用してください。
既存ユーザーをサブスクリプショングループに追加する: このエンドポイントは、既存ユーザーのサブスクリプショングループメンバーシップをバックフィルまたは一括更新するための推奨方法です。1回のリクエストで最大50件のexternal_id、メールアドレス、または電話番号を渡すことができます。ユーザーはメールユーザー設定センターのリンクから、自分のサブスクリプションステータスを更新することもできます。
サブスクリプショングループ付きで新規ユーザーを作成する: /users/trackエンドポイントを使用して新規ユーザーを作成する際、ユーザー属性オブジェクト内にサブスクリプショングループを設定できます。これにより、1回のAPIコールでユーザーの作成とサブスクリプショングループの状態設定を同時に行えます。
リクエストパラメーター
| パラメーター | 必須 | データタイプ | 説明 |
|---|---|---|---|
subscription_group_id |
必須 | 文字列 | サブスクリプショングループのid。 |
subscription_state |
必須 | 文字列 | 使用できる値は、unsubscribed(サブスクリプショングループに含まれない)またはsubscribed(サブスクリプショングループに含まれる)です。 |
external_id |
必須* | 文字列の配列 | ユーザーのexternal_id。最大50件のidを含めることができます。 |
email |
必須* | 文字列または文字列の配列 | ユーザーのメールアドレス。文字列の配列として渡すことができます。少なくとも1件のメールアドレス(最大50件)を含める必要があります。 同じワークスペース内の複数のユーザー( external_id)が同じメールアドレスを共有している場合、Brazeはそのメールアドレスを共有しているすべてのユーザーのサブスクリプショングループを更新します。 |
phone |
必須* | E.164形式の文字列 | ユーザーの電話番号。文字列の配列として渡すことができます。少なくとも1件の電話番号(最大50件)を含める必要があります。 同じワークスペース内の複数のユーザー( external_id)が同じ電話番号を共有している場合、Brazeはその電話番号を共有しているすべてのユーザーを同じサブスクリプショングループの変更で更新します。 |
use_double_opt_in_logic |
オプション | ブール値 | SMSサブスクリプショングループにのみ適用されます。メールやその他のサブスクリプショングループタイプでは無視されます。省略した場合のデフォルトはfalseです。SMSサブスクリプショングループの場合、サブスクリプションステータスがsubscribedに設定されたときにユーザーをSMSダブルオプトインワークフローに入れるにはtrueに設定します。この方法でダブルオプトインワークフローに入ったユーザーは、ワークフローに入った回数に関係なく、1日あたり最大1回のオプトインプロンプト返信メッセージを受信します。このパラメーターが省略されるかfalseに設定された場合、ユーザーはダブルオプトインワークフローを経ずに購読されます。 |
リクエスト例
メール
1
2
3
4
5
6
7
8
9
10
curl --location --request POST 'https://rest.iad-01.braze.com/subscription/status/set' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
"subscription_group_id": "subscription_group_identifier",
"subscription_state": "unsubscribed",
"external_id": "external_identifier",
"email": ["[email protected]", "[email protected]"]
}
'
SMSとRCS
1
2
3
4
5
6
7
8
9
10
curl --location --request POST 'https://rest.iad-01.braze.com/subscription/status/set' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
"subscription_group_id": "subscription_group_identifier",
"subscription_state": "unsubscribed",
"external_id": "external_identifier",
"phone": ["+12223334444", "+11112223333"]
}
'
成功応答の例
ステータスコード201は、次の応答本文を返す可能性があります。
1
2
3
{
"message": "success"
}
このエンドポイントはemailまたはphoneの値のみを受け付け、両方を同時に受け付けることはできません。両方を指定した場合、次の応答が返されます: {"message":"Either an email address or a phone number should be provided, but not both."}