diff --git a/_docs/_api/endpoints/subscription_groups/post_update_user_subscription_group_status.md b/_docs/_api/endpoints/subscription_groups/post_update_user_subscription_group_status.md index 9638cc675d5..b3cfb3262b5 100644 --- a/_docs/_api/endpoints/subscription_groups/post_update_user_subscription_group_status.md +++ b/_docs/_api/endpoints/subscription_groups/post_update_user_subscription_group_status.md @@ -70,8 +70,8 @@ Authorization: Bearer YOUR-REST-API-KEY This property should not be used for updating a user's profile information. Use the [/users/track]({{site.baseurl}}/api/endpoints/user_data/post_user_track/) property instead. -{% alert important %} -When creating new users via the [/users/track]({{site.baseurl}}/api/endpoints/user_data/post_user_track/) endpoint, you should leave a delay of around 2 minutes before adding users to the relevant Subscription Group to allow Braze time to fully create the user profile. +{% alert tip %} +When creating new users via the [/users/track]({{site.baseurl}}/api/endpoints/user_data/post_user_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. {% endalert %} ## Request parameters diff --git a/_docs/_api/endpoints/subscription_groups/post_update_user_subscription_group_status_v2.md b/_docs/_api/endpoints/subscription_groups/post_update_user_subscription_group_status_v2.md index 2cd077f763b..f957a2f3a52 100644 --- a/_docs/_api/endpoints/subscription_groups/post_update_user_subscription_group_status_v2.md +++ b/_docs/_api/endpoints/subscription_groups/post_update_user_subscription_group_status_v2.md @@ -51,11 +51,10 @@ Authorization: Bearer YOUR-REST-API-KEY } ``` -{% alert important %} -When creating new users via the [/users/track]({{site.baseurl}}/api/endpoints/user_data/post_user_track/) endpoint, you should leave a delay of around 2 minutes before adding users to the relevant Subscription Group to allow Braze time to fully create the user profile. +{% alert tip %} +When creating new users via the [/users/track]({{site.baseurl}}/api/endpoints/user_data/post_user_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.

Note that using the [/users/track]({{site.baseurl}}/api/endpoints/user_data/post_user_track/) endpoint to create a new user and update their subscription groups is currently in early access. Contact your Braze customer success manager if you're interested in participating in the early access. {% endalert %} - ## Request parameters | Parameter | Required | Data Type | Description | diff --git a/_docs/_api/endpoints/user_data/post_user_track.md b/_docs/_api/endpoints/user_data/post_user_track.md index 4ca48a71dde..13f002a12d1 100644 --- a/_docs/_api/endpoints/user_data/post_user_track.md +++ b/_docs/_api/endpoints/user_data/post_user_track.md @@ -145,6 +145,42 @@ curl --location --request POST 'https://rest.iad-01.braze.com/users/track' \ }` ``` +## Example request to set subscription groups + +This example shows how you can create a user and set their subscription group within the user attributes object. + +{% alert important %} +Using endpoint to create a new user and update their subscription groups is currently in early access. Contact your Braze customer success manager if you're interested in participating in the early access. +{% endalert %} + +``` +curl --location --request POST 'https://rest.iad-01.braze.com/users/track' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer YOUR-API-KEY-HERE' \ +--data-raw '{ + "attributes": [ + { + "external_id": "user_identifier", + "email": "example@email.com", + "email_subscribe": "subscribed", + "subscription_groups" : [{ + "subscription_group_id": "subscription_group_identifier_1", + "subscription_state": "unsubscribed" + }, + { + "subscription_group_id": "subscription_group_identifier_2", + "subscription_state": "subscribed" + }, + { + "subscription_group_id": "subscription_group_identifier_3", + "subscription_state": "subscribed" + } + ] + } + ] +}' +``` + ## Responses When using any of the aforementioned API requests, you should receive one of the following three general responses: diff --git a/_docs/_api/objects_filters/user_attributes_object.md b/_docs/_api/objects_filters/user_attributes_object.md index 0fa6a73a7a8..6eb629a58ae 100644 --- a/_docs/_api/objects_filters/user_attributes_object.md +++ b/_docs/_api/objects_filters/user_attributes_object.md @@ -115,6 +115,7 @@ The following user profile fields are case sensitive, so be sure to reference th | phone | (string) | | push_subscribe | (string) Available values are "opted_in" (explicitly registered to receive push messages), "unsubscribed" (explicitly opted out of push messages), and "subscribed" (neither opted in nor out). | | push_tokens | Array of objects with `app_id` and `token` string. You may optionally provide a `device_id` for the device this token is associated with, e.g., `[{"app_id": App Identifier, "token": "abcd", "device_id": "optional_field_value"}]`. If a `device_id` is not provided, one will be randomly generated. | +| subscription_groups| Array of objects with `subscription_group_id` and `subscription_state` string. | | time_zone | (string) Of time zone name from [IANA Time Zone Database][26] (e.g., "America/New_York" or "Eastern Time (US & Canada)"). Only valid time zone values will be set. | | twitter | Hash containing any of `id` (integer), `screen_name` (string, Twitter handle), `followers_count` (integer), `friends_count` (integer), `statuses_count` (integer). | {: .reset-td-br-1 .reset-td-br-2} @@ -123,6 +124,8 @@ Language values that are explicitly set via this API will take precedence over t #### User attribute example request +This example contains two user attribute objects with the allowed 75 requests per API call. + ```json POST https://YOUR_REST_API_URL/users/track Content-Type: application/json @@ -147,14 +150,11 @@ Authorization: Bearer YOUR-REST-API-KEY "user_alias" : { "alias_name" : "device123", "alias_label" : "my_device_identifier"}, "first_name" : "Alice", "has_profile_picture" : false, - } + }, ] } ``` -This example contains two User Attribute objects of the allowed 75 per API call. - - [2]: {{site.baseurl}}/user_guide/data_and_analytics/user_data_collection/language_codes/ [3]: {{site.baseurl}}/help/help_articles/push/push_token_migration/ [6]: {{site.baseurl}}/developer_guide/platform_wide/analytics_overview/#arrays