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 integration 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, 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 integration also supports Upsert and Replace.
Upsert Audience Data
Upsert updates existing data and inserts any new additional data in the data extension. Both the update and insert operation use the data extension primary key to determine if a record existed or not to perform the update or insert. All the existing data in the target data extension remains.
Replace Audience Data
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 email for targeted customers every time.
When replace is selected for this integration:
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.
If there is a schema error (missing primary_key) in the exported results, the existing records in the data extension are not cleared.
When you use replace, the deleted data is unrecoverable. The connector clears all the data before pushing new data. Therefore, whether your job succeeds or fails, the data is cleared.
As a best practice, use replace with data that is temporary and when data history is not important.
To use replace, 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.
Basic knowledge of Treasure Data
Basic knowledge of Salesforce Marketing Cloud
This connector also requires that the Data Extension have a primary key that uniquely identifies each record.
In addition, the Data Extension needs to have 2 fields or more if you use Synchronous API.
If you specify 'Create Data Extension' in order to create a new Data Extension, only 1 column as primary key is supported. Specify the multiple columns will cause an error.
Create an Installed App in Salesforce Marketing Cloud
Treasure Data supports both Legacy and Enhanced Package in Salesforce Marketing Cloud.
We highly recommend you create an Enhanced Package.
Create Enhanced Functionality Package
Log on to your Salesforce Marketing Cloud account.
On the Welcome Page, select your name on top right corner. Select Setup.
On the left side menu of new screen, navigate to App > Installed Packages.
On the Installed Packages screen. Select New.
Type the Name and Description.
Select Add Component.
- Select API Integration.
Locate Contacts > Audiences and to Contacts > List and Subscribers.
Select Read and Write under both to use Replace Audience feature.
Locate Data > Data Extensions.
Select Read and Write.
You need these permissions to write data to Salesforce Marketing Cloud.
Locate the Components panel.
Make note of the Client Id, Client Secret and Authentication Base URI.
You use the 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.
Open TD Console.
Navigate to Integrations Hub > Catalog.
Search for and select Salesforce Marketing Cloud Version 2.
Select Enhanced Package Integration.
Select Enhanced Functionality Package, then enter the Client Id, Client Secret and Authentication Base URI (which you obtained when you created the enhanced package in SFMC). Optionally, you could specify:
-Account identifier or MID to access multiple BUs.
-Scope to limit the token's scope (more detail in API scopes).
Name the Connection
Type a name for your connection.
Configure Export Results
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.
Open TD Console.
Navigate to Data Workbench > Queries > New Query.
Type your query in the query editor. For example:
SELECT name as customer_name, email as primary_key FROM data_extension limit 10
The primary key can be a text field.
Select Export Results located at top of your query editor.
Select an existing connection.
- Specify a Folder Path. Optionally, if any Folder in Folder Path does not exist, select Create New Folder if not Exists to create folder.
Specify a Data Extension Name. Optionally, if your Data Extension does not exist, select Create Data Extension to create a brand new data extension.
If using an existing Data Extension Name and you want to use Asynchronous API, select Using Async API. To use the Synchronous API, leave the box unchecked.
If creating a new data extension, select Create Data Extension. With the newly created data extension, input your Data Extension Name and name the Primary Column in your new data extension.
- Long & Text are two supported data types for Primary Column. If Text is Primary Column, you can specify Text length for Primary Key to optimize data extension performance by not unnecessarily allocating unused space.
Select the Is Sendable option, if your data extension is sendable.
Set your Sendable Rule by Subscriber Key or Email Address.
Select your Sendable Column as a sendable property in your data extension.
Select Data Operation for your data extension
Upsert to add when there are new records or update when records are duplicated.
Replace to delete records and completely replace them for each new export.
Replaced data will not be recoverable.
Run the Query
Select Run to run the query.
Check the query results are written to the configured data extension.
Plugin Configuration and Options
Installed package client key
Installed package client secret
Authenticate URI (required if auth_type=v2)
Folder Path to export Data Extension
Folder Path must satisfy these requirements:
|create_folder_if_not_exists||Flag to indicate created new folder in folder_path or not|
Only effect if folder_path is provided (and not empty)
default is false
Data Extension name
Flag to indicate create new data extension if it is not existed
default is false
Name of primary column (required of create_new_de=true)
Only 1 column can be specified.
Length of text field when it is selected as primary column
max: 4000, min: 10 (default: 4000)
Flag to indicate created DE is sendable or not
default is false
Your account’s configured sendable business rule (required if is_sendable=true)
Column name to use as sendable property (required if is_sendable=true
Determine whether clear data in DE before inserting
default is upsert
Flag to indicate using asynchronous or synchronous API from SFMC
default is false
Flag to indicate continue running if there is an insertion error (applied only for synchronous API)
default is true
Number of records that will be sent in one API call. (This option is only applied to asynchronous APIs.)
max: 32000 (default), min: 100
Example configuration for using Synchronous APIs to upsert data extension using Enhanced package.
out: type: salesforce_marketing_cloud_v2 client_id: Th1s1s4n3x4mpl3Cl13nt1ds client_secret: Th1s1s4F4k3dCl13ntS3cr3t auth_type: v2 auth_uri: https://th1s1sf4k3d1nst4nc3h0st.auth.marketingcloudapis.com/ de_name: data_extension_name continue_on_failure: false
Example configuration for Asynchronous APIs to upsert data extension using Enhanced package.
out: type: salesforce_marketing_cloud_v2 client_id: Th1s1s4n3x4mpl3Cl13nt1ds client_secret: Th1s1s4F4k3dCl13ntS3cr3t auth_type: v2 auth_uri: https://th1s1sf4k3d1nst4nc3h0st.auth.marketingcloudapis.com/ de_name: data_extension_name async: true
Example configuration for Asynchronous APIs to upsert data extension using Enhanced package and create new Sendable data Extension if not existed.
out: type: salesforce_marketing_cloud_v2 client_id: Th1s1s4n3x4mpl3Cl13nt1ds client_secret: Th1s1s4F4k3dCl13ntS3cr3t auth_type: v2 auth_uri: https://th1s1sf4k3d1nst4nc3h0st.auth.marketingcloudapis.com/ de_name: data_extension_name create_new_de: true primary_column: primary_key primary_text_length: 32 is_sendable: true sendable_column: mytext sendable_rule: Subscriber Key async: true records_per_batch: 32000
Example configuration for Export data extension to a specific folder
out: type: salesforce_marketing_cloud_v2 client_id: xxxxxxxxxxxxxxxxxxxxxxxxx client_secret: xxxxxxxxxxxxxxxxxxxxxxxxx auth_type: v2 auth_uri: https://th1s1sf4k3d1nst4nc3h0st.auth.marketingcloudapis.com/ folder_path: /Data Extensions/FolderPath2/FolderPath3/FolderPath3 create_folder_if_not_exists: true de_name: data_extension_name create_new_de: true primary_column: primary_key primary_text_length: 32 is_sendable: true sendable_column: mytext sendable_rule: Subscriber Key async: true records_per_batch: 32000