Treasure Data can publish user segments into Salesforce Marketing Cloud (ExactTarget), and enable you to send personalized emails to your customers. You can run data-driven email campaigns, by using your first party data from Web, Mobile, CRM, and other data sources.

For sample workflows of this, view Treasure Boxes.

Treasure Data provides two methods to write job results to Salesforce Marketing Cloud (SFMC), our SFTP and SFMC plugins.

This SFMC plugin can be used for small and medium data sets. We recommend you use SFTP for large data sets.



Synchronous or Asynchronous API

This data connector supports two kinds of APIs to put records into SFMC: Synchronous APIs and Asynchronous APIs.

As a best practice, if you are trying to put a result set with less than 100,000 records into SFMC, Synchronous APIs is a great fit. However, if you are planning to send a million+ data set, then consider using Asynchronous APIs because it provides higher availability and reliability in comparison with Synchronous APIs.

In order to use the Asynchronous APIs, you must ensure that your SFMC account is enabled as a Data Extensions Async REST API from Salesforce Marketing Cloud. You can also create a support case in Salesforce Marketing Cloud to have them enable it.

Replace or Upsert Existing Audience Data in a Data Extension

This data connector also supports two modes to perform with existing data in a data extension--Upsert and Replace.

Upsert Audience Data

The first mode is Upsert which updates existing data and inserts any new additional data in the data extension. Both update or insert operations will use the data extension primary key to determine if a record existed or not in order to perform update or insert. All the existing data in the target data extension remains.

Replace Audience Data

The second mode is Replace which means before updating data, we will clear all existing data in the target data extension. This mode useful if you need only the newest data in the data extension each time in order to send an email to targeted customers every time.

When you use this mode, the deleted data is unrecoverable. The connector will clear all the data before pushing new data which means whether your job succeeds or fails, the data will be cleared.

As a best practice, use this mode with data that is temporary and when data history is not important.

In order to use this mode, your account must be an Enterprise 2.0 account and the installed package must have admin privileges. Contact your Customer Success representative to find out more.

Prerequisites

  • Basic knowledge of Treasure Data

  • Basic knowledge of Salesforce Marketing Cloud

  • TD account

This connector also requires that the Data Extension have a primary key that uniquely identifies each record.

Create an Installed App in Salesforce Marketing Cloud

Treasure Data supports several versions for Salesforce Marketing Cloud.

Enhanced Package: We highly recommend that you use the Salesforce Marketing Cloud Export Integration. Rather than the legacy integration.

Create a Legacy Package

  1. Log on to your Salesforce Marketing Cloud account

  2. On the Welcome Page, select your name on top right corner and select Setup.

  3. Navigate to App > Installed Packages.

  4. On the Installed Packages screen, select New.


  5. In New Package Details, enter the Name and Description. Clear Create with enhanced functionality (recommended).

  6. Select Save.


  7. On the Package Details screen, select Add Component.


  8. On Add Component, select API Integration. Select Next.


  9. On the Add API Integration screen, scroll to Contacts > Audiences and to Contacts > List and Subscribers.

  10. Select Read and Write under both in order to use Replace Audience feature.

  11. Scroll down to the Data > Data Extensions.

  12. Select Read and Write. You need these permissions to write data to Salesforce Marketing Cloud.

  13. Select Save.


  14. On the Installed Packages screen, scroll down to the Components panel. Copy down the Client Id and Client Secret. You use that information to write the data from Treasure Data to Salesforce Marketing Cloud.


Using TD Console

Complete the following steps to export TD query results to a Salesforce Marketing Cloud Data Extension:

Create a New Data Connection


When you configure a data connection, you provide authentication to access the integration. In Treasure Data, you configure the authentication and then specify the source information.

  1. Open TD Console.

  2. Navigate to Integrations HubCatalog.

  3. Search for and select Salesforce Marketing Cloud.


  4. The following dialog opens. Select a Legacy Package Integration.


Create a Legacy Package Integration

  1. In the New Authentication dialog, select Legacy Package, then enter the Client Id and Client Secret (which you obtained when you created legacy package in SFMC). Select Continue.


  2. Enter a Name for this integration and select Done.



Configure Export Results in Your Data Connection

In this step, you create or reuse a query. In the query, you configure the data connection.

Sometimes you need to define the column mapping in the query.

Configure the Connection by Specifying the Parameters

  1. Open the TD Console.

  2. Navigate to Data Workbench > Queries > New Query.


  3. Enter your query in the query editor.

  4. Select Export Results located at top of your query editor. 


    The Choose Integration dialog opens.
    You have two options when selecting a connection to use to export the results, using an existing connection or creating a new one.

Use an Existing Connection

  1. Type the connection name in the search box to filter.

  2. Select your connection.


  3. On the Export Results screen, enter a Data Extension Name.

  4. Select one of the following:

    1. To use Asynchronous API, select the Using Async API checkbox. To use the Synchronous API, leave the box clear.

    2. Continue on failure.


  5. Select Done.

Run the Query

  1. Select Run to run the query.

  2. Check the query results are written to the configured data extension.


Plugin Configuration and Options

Available Configurations

Configuration name

Description

Type

Sample value

client_id

Installed package client key

string

Th1s1s4n3x4mpl3Cl13nt1ds

client_secret

Installed package client secret

string

Th1s1s4F4k3dCl13ntS3cr3t

auth_type

Authenticate type

string

v1 (for the legacy package)

v2 (for the enhanced package)

auth_uri

Authenticate URI (required if auth_type=v2)

string

https://th1s1sf4k3d1nst4nc3h0st.auth.marketingcloudapis.com/

de_name

Data Extension name

string

data_extension_name

create_new_de

Flag to indicate create new data extension if it does not exist

boolean

default is false

true (create new DE if it doesn’t exist)

false (do not create a new DE if doesn’t exist)

is_sendable

Flag to indicate created DE is sendable or not

boolean

default is false

true

false

sendable_rule

Your account’s configured sendable business rule (required if is_sendable=true)

string

Subscriber Key (if the business rule is Subscriber Key)

Email Address (if the business rule is Email Address)

sendable_column

Column name to use as sendable property (required if is_sendable=true

string

my_sendable_column

async

Flag to indicate using asynchronous or synchronous API from SFMC

boolean

default is false

true (using Async API)

false (using Synchronous API)

continue_on_failure

Flag to indicate continue running if there is an insertion error (applied only for synchronous API)

boolean

default is true

true

false

Example Configurations

Example configuration for using Synchronous APIs to upsert data extension using the Legacy package.

out:
 type: salesforce_marketing_cloud
 client_id: Th1s1s4n3x4mpl3Cl13nt1ds
 client_secret: Th1s1s4F4k3dCl13ntS3cr3t
 auth_type: v1
 de_name: data_extension_name
 continue_on_failure: false


Example configuration for Asynchronous APIs to upsert data extension using the Legacy package.

out:
 type: salesforce_marketing_cloud
 client_id: Th1s1s4n3x4mpl3Cl13nt1ds
 client_secret: Th1s1s4F4k3dCl13ntS3cr3t
 auth_type: v1
 de_name: data_extension_name
 async: true


When Replace is Selected

If:

  • There is a data error (NULL value, wrong data type, invalid primary key) in the exported results, all the records in the Data Extension are cleared and not recoverable, but the invalid data is not exported.

  • There is a schema error (missing primary_key) in the exported results, the existing records in the data extension are not cleared.