# Brevo (formerly Sendinblue)

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

**Premium Feature:** Brevo
{% endhint %}

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

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

## Implementation

### Connection

Didomi connects to Brevo on your behalf through API calls using an API key. Therefore, every time preferences are collected using the Didomi Platform, it triggers an event that updates the attributes of your Brevo profiles. You can use the Didomi user's property `organization_user_id` to identify and link your profiles on both platforms.

### Options

* **Upsert mode**: You can choose allowing Didomi to create contacts on Brevo, by setting `upsert_mode` to true. Otherwise, when a consent is collected but the `organization_user_id` value does not match with any contact in Brevo, the consent update will not be propagated to Brevo.
* **Bidirectional flow**: Please note that the bidirectional flow is not supported at the moment.

### Mapping

Didomi uses the entity contact of Brevo and sends the attributes property when updating a contact, hence consent events are mapped to the contact attributes.

You may also use a consent event to add or remove a contact to/from your Brevo blacklist. To do so, in the `properties` object you need use the id `EMAIL_CAMPAIGNS_SUBSCRIBED` and map it with a purpose or a preference value from your PMP.

{% 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 %}

## Configuration

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

| Property        | Description                                                                                        | Required                           |
| --------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **API Key**     | API key of your Brevo to connect to the Brevo API                                                  | Yes                                |
| **List ID**     | When the Upsert mode is enabled, you can provide a list id where the new contacts will be created. | No                                 |
| **Upsert mode** | By setting upsert\_mode to true you allow Didomi to create contacts on Brevo.                      | <p>No<br>Default value = false</p> |
| **Mappings**    | List of properties to match between Didomi and Brevo.                                              | Yes                                |

### Example

```json
{
    "type_id": "sendinblue",
    "authentication": {
        "private_api_key": "private_api_key"
    },
    "properties": {
        "list_id": "your_list_id"
    },
    "mappings": [
        {
	    "id": "EMAIL_NOTIFICATION",
	    "value": "consents_purposes_newsletter_enabled"
	}
    ],
    "upsert_mode": true
}
```
