Skip to content

ユーザーのサブスクリプショングループステータスの更新 (V2)

post

/v2/subscription/status/set

このエンドポイントを使用して、Braze ダッシュボード上で最大50ユーザーのサブスクリプション状態を一括更新します。

サブスクリプショングループのsubscription_group_idにアクセスするには、サブスクリプショングループページに移動します。

メールサブスクリプショングループの例を見たり、このエンドポイントをテストするには:

SMS サブスクリプショングループの例を見たり、このエンドポイントをテストする:

WhatsApp Groups用のエンドポイントの例を見る、またはテストする:

前提条件

このエンドポイントを使用するには、subscription.status.set 権限を持つAPI キーが必要である。

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コールを行う必要がある。

レート制限

このエンドポイントには、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),
    }
  ]
}

リクエストパラメーター

例のリクエスト

以下の例では、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"]
    }
  ]
}
'
New Stuff!