# Salesforce Marketing Cloud

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

**Premium Feature:** Salesforce Marketing Cloud
{% endhint %}

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

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

## Implementation

### **Connection**

Didomi connects to Marketing Cloud on your behalf through API calls using **Installed packages.** You need to fetch your `Client id`, `Client secret` and `Authentication Base URI.`

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

{% hint style="warning" %}
Please note that the **`upsert_mode`** option is always set to **`false`** for Salesforce Marketing Cloud. This means that if the collected consent contains an **`organization_user_id`** that has no match in Marketing Cloud, Didomi will **not create a new contact and skip the update**. The **`organization_user_id`** must **match an existing contact** for the consent to be processed.
{% endhint %}

* **Bidirectional flow**: Please note that the bidirectional flow is not supported at the moment.

### **Mapping**

Didomi uses the entity Contact of Marketing Cloud. The PMP purpose/preference/value can be mapped with an `attribute` within `attribute set` of your Audience builder. Hence, a `properties.id` is a combination of attribute set and attribute name separated by a colon `:` (Cf. the example below).

{% hint style="warning" %}
For Salesforce Marketing Cloud native demographics (Email demographics, MobileConnect demographics..) your contact attributes may not be updated due to missing mandatory information.\
Here are some non exhaustive examples that you can also check with your Marketing Cloud expert:

* Email Addresses: contacts with no attached email address will not be updated through Didomi and SalesForce Marketing Cloud integration.
* MobileConnect Demographics: your contact must include a country code for the `Locale` value, otherwise the Didomi preference update will not be reflected on your contact
* MobilePush Demographics: your contact must include an `ApplicationID` value.
* GroupConnect: LINE Addresses and LINE Subscriptions fields are required for a contact to be updated with the Didomi preferences.
  {% endhint %}

## Configuration

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

<table><thead><tr><th>Property</th><th width="344.3333333333333">Description</th><th>Required</th></tr></thead><tbody><tr><td>Client ID</td><td>Client ID issued when you create the API integration in Installed Packages</td><td>Yes</td></tr><tr><td>Client Secret</td><td>Client secret issued when you create the API integration in Installed Packages.</td><td>Yes</td></tr><tr><td>URL</td><td>Url of the account’s authentication endpoint</td><td>Yes</td></tr><tr><td>Mappings</td><td>Mapping for properties between Didomi and Salesforce Marketing Cloud</td><td>Yes</td></tr></tbody></table>

### Example

```jsx
{
    "type_id": "sf-marketing-cloud",
    "authentication": {
        "client_id": "xxxx-xxxx-xxxx-xxxx",
	"client_secret": "xxxx-xxxx-xxxx-xxxx",
	"url": "<https://xxx-xxx.auth.marketingcloudapis.com/v2/token>"
    },
    "properties": {},
    "mappings": [
        {
	    "id": "Attribute Set:Attribute Name",
	    "value": "consents_purposes_cookies_preferences_newsletter_channel_email_enabled"
	}
    ],
    "upsert_mode": true
}
```
