ユーザーのサブスクリプショングループステータスの更新 (V2)
/v2/subscription/status/set
このエンドポイントを使用して、Braze ダッシュボード上で最大50ユーザーのサブスクリプション状態を一括更新します。
サブスクリプショングループのsubscription_group_idにアクセスするには、サブスクリプショングループページに移動します。
メールサブスクリプショングループの例を見たり、このエンドポイントをテストするには:
SMS サブスクリプショングループの例を見たり、このエンドポイントをテストする:
WhatsApp Groups用のエンドポイントの例を見る、またはテストする:
前提条件
このエンドポイントを使用するには、subscription.status.set 権限を持つAPI キーが必要である。
このエンドポイントをLINEサブスクリプショングループで使用することに興味がある場合は、カスタマーサクセスマネージャーに連絡すること。
V1との違い
V2エンドポイントはV1エンドポイントと以下の点で異なる:
- 複数のサブスクリプショングループ:V2では、1回のAPIリクエストで複数のサブスクリプショングループを更新できるが、V1では1回のリクエストで1つのサブスクリプショングループしかサポートしない。
- 1回の通話でメールとSMSの両方を更新:
external_idsを使用する場合、1回のAPIコールで同じユーザーのメールとSMSの両方のサブスクリプショングループを更新することができる。V1では、メールとSMSのサブスクリプショングループ用に別々のAPIコールを行う必要がある。 - メールや電話の識別子を使用すること:
external_idsの代わりにemailsまたはphonesを使用する場合、同じリクエストでメールと SMS の両方のサブスクリプショングループを更新することはできない。メールサブスクリプショングループ用とSMSサブスクリプショングループ用に、それぞれ別のAPIコールを行う必要がある。
電話番号の形式電話番号は、E.164 形式でなければならない(例えば、+12223334444 )。E.164 形式でない電話番号は拒否される。
レート制限
このエンドポイントには、API レート制限に記載されているように、/v2/subscription/status/set および /v2/subscription/status/set エンドポイントで共有される1分あたり5000リクエストのレート制限があります。
Request body
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),
}
]
}
/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 件)。電話番号は、E.164 形式でなければならない(例えば、+12223334444 )。同じワークスペース内の複数のユーザー ( external_id) が同じ電話番号を共有している場合、その電話番号を共有しているすべてのユーザーは同じ購読グループの変更で更新されます。 |
use_double_opt_in_logic |
オプション | ブール値 | このパラメータが省略されるか、またはfalse に設定された場合、ユーザーはSMSダブルオプトインワークフローに入力されない。 |
識別子を選択する:
- 1回のAPIコールでメールとSMSの両方のサブスクリプショングループを更新するには、
external_idsを使用する。同じリクエストにemailsとphonesの両方を含めることはできない。 external_idsの代わりにemailsまたはphonesを使用する場合、メールサブスクリプショングループ用と SMS サブスクリプショングループ用にそれぞれ別の API 呼び出しを行う。emails、phones、external_idsを個別に送ることができる。
例のリクエスト
以下の例では、external_ids 、1回のAPIコールでメールとSMSの両方のサブスクリプショングループを更新している。これは、external_idsを使用する場合にのみ可能である。emails またはphones を使用する場合、1回の通話でメールとSMSの両方のサブスクリプショングループを更新することはできない。
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","[email protected]"]
},
{
"subscription_group_id":"subscription_group_identifier",
"subscription_state":"subscribed",
"external_ids":["example-user","[email protected]"]
}
]
}
メール
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":["[email protected]","[email protected]"]
}
]
}
'
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"]
}
]
}
'
GitHub でこのページを編集