# Braze

{% hint style="success" %}
**Available for:** Preference Management Platform (PMP)&#x20;

**Premium Feature:** Braze

**Status**: Beta (please contact <support@didomi.io> to test it)
{% endhint %}

Didomi allows you to update your Braze contact attributes with the preferences collected through your preference management platform (PMP).

{% hint style="info" %}
Alternatively, the Braze integration can be performed directly from the Didomi console for the Preference Management Platform (PMP).&#x20;
{% endhint %}

## **Implementation**

### **Connection**

Didomi connects to Braze on your behalf through API calls using the API key and the Server instance of your Braze account. Therefore, every time preferences are collected using the Didomi Platform, it triggers an event that updates the attributes of your Braze users.

You can use the Didomi user's property `organization_user_id` to identify and link your users on both platforms.

{% hint style="warning" %}
**Note**: In order to ensure that events are received, Didomi will retry at least five times in the span of five minutes before moving on when your endpoint is down.
{% endhint %}

### **Options**

* **Upsert mode**: Please note that the Upsert mode is not supported for this connector.
* **Bidirectional flow**: Please note that the bidirectional flow is not supported at the moment.

### **Mapping**

Didomi uses the entity user of Braze and supports the following user updates:

1. Opted-in: means the user has explicitly chosen to receive email campaigns. This mapping option can be used in your Braze integration through the id `OPTED_IN` in the `properties` object.
2. Unsubscribed: means the user has explicitly chosen to unsubscribe from getting email campaigns. To use this mapping option in your Braze integration, you need to use the id `UNSUBSCRIBED` under the `properties` object, and map it with a purpose or a preference value from your PMP.
3. Subscription to a custom group: If you chose to segment your audience through [custom subscription groups](https://www.braze.com/docs/user_guide/message_building_by_channel/email/managing_user_subscriptions/#subscription-groups), Didomi also allow you to add/remove users from those groups based on their preference choices. You will simply need to map your subscription group id with a purpose or a preference from your PMP.

## **Configuration**

Didomi needs the following configuration items to set up the connection with Braze:

| Property | Description                                          | Required |
| -------- | ---------------------------------------------------- | -------- |
| API key  | An API key of Braze account                          | Yes      |
| Server   | Server instance of Braze account                     | Yes      |
| Mappings | List of properties to match between Didomi and Braze | Yes      |

### **Example**

```json
{
    "type_id": "braze",
    "authentication": {
        "api_key": "Your Braze API Key",
        "server": "Your Braze server URL",
    },
    "properties": {},
    "mappings": [
        {
            "id": "OPTED_IN", // Native state in braze to tag the users who have explicitly opted-in to receive emails.
            "value": "consents_purposes_<purpose>_enabled"
        },             
        {
            "id": "UNSUBSCRIBED", // Native state in braze to tag the users who have explicitly unsubscribed from emails.
            "value": "consents_purposes_<purpose>_enabled"
        },
        {
            "id": "subscription_group_id", // Custom Subscription group that could be created in Braze
            "value": "consents_purposes_<purpose>_enabled"
        }
    ],
    "upsert_mode": true
}
```
