# Sendinblue Cloud Mode Integration

RudderStack lets you send your event data to Sendinblue via [cloud mode]({{< ref "destinations/rudderstack-connection-modes.md#cloud-mode" >}}).

Find the open source code for this destination in the <a href="https://github.com/rudderlabs/rudder-transformer/tree/main/src/v0/destinations/">GitHub repository</a>.

## Identify

You can use the [`identify`]({{< ref "event-spec/standard-events/identify.md" >}}) call to add a contact in Sendinblue. If a contact already exists, RudderStack updates the contact details.


A sample `identify` call is shown below:

```javascript
rudderanalytics.identify(
  "alex@example.com", {
    firstName: "Alex",
    lastName: "Keener",
    phone: "+12025550146",
    payment: 2,
    age: 21,
    location: "USA",
  }, {
    externalId: [{
        type: "sendinblueIncludeListIds",
        id: [1,2],
      },
    ],
  }
);
```

### Supported mappings

This section explains the property mappings for `identify` call made to perform different operations on contacts such as their creation, deletion, updation, etc.

#### Create or update a contact

The following table details the property mappings between RudderStack and Sendinblue to [create or update a contact](https://developers.sendinblue.com/reference/createcontact):

| RudderStack property | Sendinblue property | Data type |
| :-----| :--------| :------|
| `traits.email` <br/> `context.traits.email` <br/> `properties.email` <br/> <span style="color: #4D4DFF;font-size:12px;">Required, if phone number is not present.</span>| `email`  | String |
| `traits.phone` <br/> `context.traits.phone` <br/> `properties.phone` <br/>  <span style="color: #4D4DFF;font-size:12px;">Required, if email is not present.</span>| `attributes.SMS`  |  String |
| `traits.newEmail` <br/> `context.traits.newEmail` | `attributes.EMAIL`  | String |
| `traits.firstName` <br/> `traits.firstname` <br/> `traits.first_name` <br/>  `context.traits.firstName` <br/> `context.traits.firstname` <br/> `context.traits.first_name`   | `attributes.FIRSTNAME` | String | 
| `traits.lastname` <br/> `traits.last_name` <br />`context.traits.lastName` <br/> `context.traits.lastname` <br/> `context.traits.last_name` <br/> `traits.lastName`   | `attributes.LASTNAME` | String | 
| `traits` <br/> `context.traits` | `attributes` | Object |
| `integrations.sendinblue.emailBlacklisted`| `emailBlacklisted` | Boolean |
| `integrations.sendinblue.smsBlacklisted`| `smsBlacklisted` | Boolean |
| `context.externalId.id` *(when `context.externalId.type` = `sendinblueIncludeListIds`)* | `listIds` | Int64 Array |

#### Create contact via DOI (Double-opt-in) flow 

The following table details the property mappings between RudderStack and Sendinblue to [create a contact via DOI flow](https://developers.sendinblue.com/reference/createdoicontact):

| RudderStack property | Sendinblue property | Data type |
| :-----| :--------| :------|
| `traits.email` <br/> `context.traits.email` <br/> `properties.email` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span>| `email`  | String |
| `context.externalId.id` *(when `context.externalId.type` = `sendinblueIncludeListIds`)* <span style="color: #4D4DFF;font-size:12px;">Required</span> | `includeListIds` | Int64 Array  |
| `context.externalId.id` *(when `context.externalId.type` = `templateId`)* <br/> OR <br/> `templatedId` *(defined in RudderStack dashboard)* <span style="color: #4D4DFF;font-size:12px;">Required</span> | `templateId` | Int64 (DOI template's ID) |
| Redirection URL *(defined in RudderStack dashboard)* <span style="color: #4D4DFF;font-size:12px;">Required</span>| `redirectionUrl` | URL |
| `traits.phone` <br/> `context.traits.phone` <br/> `properties.phone` | `attributes.SMS`  |  String |
| `traits.firstName` <br/> `traits.firstname` <br/> `traits.first_name` <br /> `context.traits.firstName` <br/> `context.traits.firstname` <br/> `context.traits.first_name`   | `attributes.FIRSTNAME` | String | 
| `traits.lastName` <br/> `traits.lastname` <br/> `traits.last_name` <br/>  `context.traits.lastName` <br/> `context.traits.lastname` <br/> `context.traits.last_name`   | `attributes.LASTNAME` | String | 
| `traits` <br/> `context.traits` | `attributes` | Object |


#### Update a DOI contact

The following table details the property mappings between RudderStack and Sendinblue to [update a DOI contact](https://developers.sendinblue.com/reference/updatecontact):

| RudderStack property | Sendinblue property | Data type |
| :-----| :--------| :------|
| `traits.email` <br/> `context.traits.email` <br/> `properties.email` <br/> `context.externalId.id` *(when `context.externalId.type` = `sendinblueContactId`)* <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span>| `identifier`  | String |
| `traits.phone` <br/> `context.traits.phone` <br/> `properties.phone` | `attributes.SMS`  |  String |
| `traits.newEmail` <br/> `context.traits.newEmail` | `attributes.EMAIL`  | String |
| `traits.firstName` <br/> `traits.firstname` <br/> `traits.first_name` <br/> `context.traits.firstName` <br/> `context.traits.firstname` <br/> `context.traits.first_name`    | `attributes.FIRSTNAME` | String | 
| `traits.lastName` <br/> `traits.lastname` <br/> `traits.last_name` <br/> `context.traits.lastName` <br/> `context.traits.lastname` <br/> `context.traits.last_name`    | `attributes.LASTNAME` | String | 
| `traits` <br/> `context.traits` | `attributes` | Object |
| `integrations.sendinblue.emailBlacklisted`| `emailBlacklisted` | Boolean |
| `integrations.sendinblue.smsBlacklisted`| `smsBlacklisted` | Boolean |
| `context.externalId.id` *(when `context.externalId.type` = `sendinblueIncludeListIds`)* | `listIds` | Int64 array |
| `context.externalId.id` *(when `context.externalId.type` = `sendinblueUnlinkListIds`)*| `unlinkListIds` | Int64 array |




#### Delete contact from list

{{< warning >}}
RudderStack uses this API to delete a contact from a given list **if** the **Create contact via Double-opt-in** setting is disabled in the dashboard and `sendinblueUnlinkListIds` is provided in the event's `externalId` field.
{{< /warning >}}

The following table details the property mappings between RudderStack and Sendinblue to [delete a contact from list](https://developers.sendinblue.com/reference/removecontactfromlist):

| RudderStack property | Sendinblue property | Data type |
| :-----| :--------| :------|
| `traits.email` <br/> `context.traits.email` <br/> `properties.email` <br/> `traits.phone` <br/> `context.traits.phone` <br/> `properties.phone` <br/>  <span style="color: #4D4DFF;font-size:12px;">Required, if contactID is not present.</span>| `emails`  | String |
| `context.externalId.id` *(when `context.externalId.type` = `sendinblueContactId`)* | `ids`  | String |

## Track

You can use the [`track`]({{< ref "event-spec/standard-events/track.md" >}}) call to:

- **[Track event](https://tracker-doc.sendinblue.com/reference/trackevent-3)**: Capture events on your website along with (optional) extra information about the event.
- **[Track Link](https://tracker-doc.sendinblue.com/reference/tracklink-3)**: Capture clicks on your website along with (optional) extra information about the click.

A sample `track` call is shown below:

```javascript
// track events
rudderanalytics.track("Card Created", {
  id: "a4123c72-c6f7-4d8e-b8cd-4abb8a807891",
  products: [{
      product_id: 1234,
      product_name: "Track Pants",
      amount: 1,
      price: 220,
    },
    {
      product_id: 5768,
      product_name: "T-Shirt",
      amount: 5,
      price: 1058,
    },
  ],
});

//track link
rudderanalytics.track("trackLink", {
  link: "https://mail.google.com/mail/u/0/#inbox",
  subject: "Email confirmation",
});
```

{{< info >}}
RudderStack sends the track call to the **Track Link** endpoint if the event name is `trackLink` in the event payload. For any other event name, it sends the event to the **Track event** endpoint.
{{< /info >}}

### Supported mappings

This section explains the property mappings for `track` call to capture events and links on your website.

#### Track event

The following table details the property mappings between RudderStack and Sendinblue for **Track event** endpoint:

| RudderStack property | Sendinblue property | Data type |
| :-----| :--------| :------|
| `traits.email` <br/> `context.traits.email` <br/> `properties.email`<br/> `traits.phone` <br/> `context.traits.phone` <br/> `properties.phone` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | `email` | String |
| `event` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | `event` | String |
| `traits` <br/> `context.traits` | `properties` | Object |
| `properties`| `eventdata.data` | Object |
| Value of `integrations.sendinblue.propertiesIdKey` in `properties` | `eventdata.id` | String |

#### Track Link

The following table details the property mappings between RudderStack and Sendinblue for **Track Link** endpoint:

| RudderStack property | Sendinblue property | Data type |
| :-----| :--------| :------|
| `traits.email` <br/> `context.traits.email` <br/> `properties.email` <br/> `traits.phone` <br/> `context.traits.phone` <br/> `properties.phone` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span>| `email`  | String |
| `properties.link` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | `link` | String |
| `properties` | `properties` | Object |

## Page

You can use the [`page`]({{< ref "event-spec/standard-events/page.md" >}}) call to send any page-related information to Sendinblue.

A sample `page` call is shown below:

```javascript
rudderanalytics.page("Home")
```

### Supported mappings

The following table details the property mappings between RudderStack and Sendinblue:

| RudderStack property | Sendinblue property | Data type |
| :-----| :--------| :------|
| `traits.email` <br/> `context.traits.email` <br/> `properties.email`<br/> `traits.phone` <br/> `context.traits.phone` <br/> `properties.phone` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | `email` | String |
| `properties.url` <br/> `context.page.url` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | `page` | String | 
| `properties.title` <br/> `context.page.title`| `properties.ma_title` | String |
| `properties.path` <br/> `context.page.path`| `properties.ma_path`  |  String |
| `properties.referrer` <br/> `context.page.referrer`| `properties.ma_referrer` | String |
| `properties.name` <br/> `Page Viewed` | `properties.sib_name` | String |
| `properties`  | `properties` | Object |
