Preference center via API
Setting up a preference center provides a one-stop shop for your users to edit their notification preferences with your email messaging. By using the Preference Center Braze endpoints, you can directly edit the HTML of your preference center to align with your branding and to understand your users’ preferences.
Prerequisites
Requirement | Description |
---|---|
Enabled preference center | Your Braze dashboard has permissions to use the preference center feature. |
Valid app group with an email, SMS, or WhatsApp subscription group | A working app group with valid users and an email, SMS, or WhatsApp subscription group. |
Valid user | A user with an email address and an external ID. |
Generated API key with preference center permissions | In the Braze dashboard, go to Developer Console > API Settings to confirm that you have access to an API key with preference center permissions. |
Step 1: Create a preference center via API
Let’s begin building a preference center using the /preference_center/v1
endpoint. To customize your preference center, you can include HTML that aligns with your branding for the preference_center_page_html
field and confirmation_page_html
field.
The /preference_center/v1/{preferenceCenterExternalId}/url/{userId}
endpoint allows you to grab the preference center URL for a specific user outside of an email that is sent through Braze.
Step 2: Include in email campaign
Next, insert your preference center into your email campaign by pasting a combination of HTML that includes Liquid. For example, you can paste the following as the link URL in either the HTML or Drag & Drop Editor.
1
<a href="{{preference_center.${preference_center_name_example}}}">Edit your preferences</a>
The above Liquid tag will only work when launching a Campaign or Canvas. Sending a test email will not render a valid link.
Editing a preference center
You can edit and update your preference center by using the /preference_center/v1/{preferenceCenterExternalId}
endpoint.
Identifying preference centers and details
To identify your preference centers, use the /preference_center/v1/{preferenceCenterExternalId}
endpoint to return related information such as the last updated timestamp, the preference center ID, and more.