You can activate your various segments to Sailthru for personalized email marketing campaigns enabling you to provide a better customer experience.
Sailthru is a marketing automation solution that powers your every marketing email need, including campaigns, triggered and transactional email. Sailthru’s proprietary algorithms can personalize on the individual level for your emails, website, and mobile app. It’s all powered by their customer profiles. They help you send 5 million different emails to 5 million different customers. Their recommendation algorithms can personalize products, content, discounts and offers, customer journey touch points, and even email acquisition pop-ups.
This integration enables your marketing team to:
- Send lists of users from a segment to Sailthru to prepare the corresponding marketing campaigns on the system, and keep those lists automatically synchronized.
- Update all user information with different profiles from Sailthru to provide a better-personalized experience for the customer through various marketing campaigns.
- Basic knowledge of Sailthru and a Sailthru account
- Basic Knowledge of Treasure Data
There are some inherent limitations from Sailthru API:
- The custom field (e.g. vars) name adheres to Sailthru specifications.
- The maximum number of custom fields for users is 1000. (https://getstarted.sailthru.com/developers/api/user/#Error_Codes).
- The maximum number of primary lists is 50. Error message if this cap is hit: “You may only track up to 50 primary lists".
- The maximum number of total lists (including primary and secondary) is 2000. Error message if this cap is hit: “Maximum list count reached: 2000“.
- On Bulk User export mode (
target: bulk_user),signup_datecolumn won’t be updated if the batch is included withlists(either via source data’s column or result export configuration) smskey isn’t fully tested by Treasure Data.signup_datecolumn is in the CEST timezone. Refer to the Sailthru API document for examples of the supported format.
Log in to Sailthru. Navigate to https://my.sailthru.com/settings/api_postbacks.
Select the lock icon for API Key and Secret.

A dialog opens to show the API Key and Secret. This is needed to create a new connection.

Create and configure the data connection to be used during export, prior to running your query. As part of the data connection, you provide authentication to access the integration.
Open TD Console.
Navigate to Integrations Hub > Catalog
Search for and select Sailthru.
The New Authentication dialog opens.

Enter the API Key and Secret.
Enter a name for your connection.
Select Done.
Example query with valid result data:
For List export mode:
SELECT 'my@email.com' as email;For User or Bulk User export mode:
SELECT 'my@email.com' as id,
'012345' as sms,
'123' as sid,
'My Name' as name,
'Mar 11' as dob; Create or reuse a query. In the query, you configure the data connection.
About List Mode
Exporting your customer lists from Treasure Data to Sailthru triggers a corresponding Sailthru job (or several depending on the data size; generally, it will be split by 1GB per job). Because of this asynchronicity, there is a latency between when a TD job is finished, and when data is visible on the Sailthru platform. The result of your query must contain a column email.
If the list exists, the connector will update with new info (public name, is primary, etc.), and add more emails to that list. If the list doesn’t exist, the connector create new list with the info, then upload emails to the newly created list.
About User Mode
This creates new and updates existing users, allowing the export of more information for the user type. This is slower than List Export Mode because requests are executed in a per-row manner. Using this mode, Lifecycle events are triggered.
Your query result must contain the following required columns.
| Column | Description | Type | Required |
|---|---|---|---|
id | Values are either email, sid, extid, or sms. This value is dependent on the value of the ID Type configuration parameter. | string | Required |
optout_email | Either “none”, “basic”, “all” or “blast” or NULL. | string | Optional |
lists | Comma-separated lists of Sailthru List. See the Lists configuration parameter for the examples. | string | Optional |
optout_templates | Comma-separated lists of Sailthru Optout Templates. See the Opt-out Templates configuration parameter for an example of valid values. | string | Optional |
The columns that are specified on Keys and Vars parameters are optional.
About Bulk User Mode
Similar to User Mode, Bulk User mode creates new and updates existing users, allowing the export of more information for the user type. The major difference is that it won’t trigger Lifecycle events. Submissions to Sailthru API are done in the same manner with List Mode, by asynchronous bulk jobs.
Your query result can contain these columns:
| Column | Description | Type | Required |
|---|---|---|---|
id | Values are either email, sid, extid, or sms. This value is dependent on the value of the ID Type configuration parameter. | string | Required |
signup_date | The Sailthru-accepted date formatted string. For example: "Jan 18, 2013", “2016-07-01“. See Sailthru API document for more details. | string | Optional |
optout | Either “none”, “basic”, “all” or NULL. | string | Optional |
lists | Comma-separated lists of Sailthru List. See also Lists configuration parameter, for example, valid values. | string | Optional |
The columns that are specified on Keys and Vars parameters are optional.
Open the TD Console.
Navigate to Data Workbench > Queries.
Select the query that you plan to use to export data.
Select Export Results located at top of your query editor.
The Choose Integration dialog opens.Choose the authentication you created (or create a new one).
Select Next.
Configure the target output data type and its corresponding parameters.
The following Export Modes are supported:- List: Export emails to a specified list.
- User: Create or update existing users by their ID. This will trigger Lifecycle events.
- Bulk User: Create or update existing users by their ID by Sailthru bulk job. This won’t trigger Lifecycle events.
Optionally, configure one of the following:
- Configure export for lists
Select List for Export Mode.

Type your destination list name.
A new list is created if it doesn’t exist or existing list updates. You can checklist names on Sailthru.
Select either Primary or Secondary:
Primary lists are your main lists of subscribers that you send to on a regular and periodic basis. If you wish to track the growth of a list, it must be marked as primary.
Secondary lists are lists for which you do not need growth reporting. Their growth is not tracked, so they will not show up in the Primary List reports.
If an option is selected, it will update the existing list to this type. See Sailthru for the difference between primary and secondary lists.
Optionally, type the name that will be presented to your subscribers (i.e. on an opt-out page).
- Configure the export for users
Select User for Export Mode.

Select the corresponding type of your
idcolumn --email, sms, sid, extid.Optionally, If Ignore Error Records selected, export jobs will still proceed even if a user cannot be created/updated. If left unchecked, the Treasure Data jobs terminate if an error record occurs. Submitted (Sailthru) jobs can rollback. Unlike User export mode, “Ignore Error Records” is only for some client-side validation (for example, the malformed syntax of Lists or Vars). Other kinds of invalid records are automatically ignored in Sailthru’s jobs by default.
Optionally, add comma separated key columns to update the user’s keys.
The column name has to match the key type exactly.Type a value for Key Conflict Resolution.
error: terminates the job if a conflict occurs. For example, the changed keys match with another that already exists in the Sailthru database.merge: attempts to resolve the conflicted users with users that having the current
id.Optionally, update the Lists that the user belongs to.
The value has to conform to the syntax of:"List Name": 0|1, "Another List Name": 0|1, ...0will remove users from the list.1will add users to the list (if not already existing).Add or remove users from the opt-out templates.
Optionally, update Thread Count value. Thread Count refers to the number of jobs running in parallel to sent requests to Sailthru API. Thread Count must be in range of 1 to 40.
- Configure the bulk export for users
Select Bulk User for Export Mode.

Select the corresponding type of your
idcolumn --email, sms, sid, extid.Optionally, If Ignore Error Records selected, export jobs will still proceed even if a user cannot be created/updated. If left unchecked, TreasureData-side jobs terminate if an error record occurs. Submitted (Sailthru-side) jobs cannot rollback. Notes that unlike User export mode, “Ignore Error Records” is meant only for some client-side validation (for example, the malformed syntax of Lists or Vars). Other kinds of invalid records will be automatically ignored in Sailthru’s jobs by default.
Optionally, add comma separated key columns to update the user’s keys.
The column name has to match the key type exactly.Optionally, update the Lists to which the user belongs.
The value must conform to the syntax of:"List Name": 0|1, "Another List Name": 0|1, ...0will remove users from the list.1will add users to the list (if not already existing).
You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.
Treasure Data's scheduler feature supports periodic query execution to achieve high availability.
When two specifications provide conflicting schedule specifications, the specification requesting to execute more often is followed while the other schedule specification is ignored.
For example, if the cron schedule is '0 0 1 * 1', then the 'day of month' specification and 'day of week' are discordant because the former specification requires it to run every first day of each month at midnight (00:00), while the latter specification requires it to run every Monday at midnight (00:00). The latter specification is followed.
Navigate to Data Workbench > Queries
Create a new query or select an existing query.
Next to Schedule, select None.

In the drop-down, select one of the following schedule options:

Drop-down Value Description Custom cron... Review Custom cron... details. @daily (midnight) Run once a day at midnight (00:00 am) in the specified time zone. @hourly (:00) Run every hour at 00 minutes. None No schedule.

| Cron Value | Description |
|---|---|
0 * * * * | Run once an hour. |
0 0 * * * | Run once a day at midnight. |
0 0 1 * * | Run once a month at midnight on the morning of the first day of the month. |
| "" | Create a job that has no scheduled run time. |
* * * * *
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +---------- month (1 - 12)
| | +--------------- day of month (1 - 31)
| +-------------------- hour (0 - 23)
+------------------------- min (0 - 59)The following named entries can be used:
- Day of Week: sun, mon, tue, wed, thu, fri, sat.
- Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.
A single space is required between each field. The values for each field can be composed of:
| Field Value | Example | Example Description |
|---|---|---|
| A single value, within the limits displayed above for each field. | ||
A wildcard '*' to indicate no restriction based on the field. | '0 0 1 * *' | Configures the schedule to run at midnight (00:00) on the first day of each month. |
A range '2-5', indicating the range of accepted values for the field. | '0 0 1-10 * *' | Configures the schedule to run at midnight (00:00) on the first 10 days of each month. |
A list of comma-separated values '2,3,4,5', indicating the list of accepted values for the field. | 0 0 1,11,21 * *' | Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month. |
A periodicity indicator '*/5' to express how often based on the field's valid range of values a schedule is allowed to run. | '30 */2 1 * *' | Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. '0 0 */5 * *' configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month. |
A comma-separated list of any of the above except the '*' wildcard is also supported '2,*/5,8-10'. | '0 0 5,*/10,25 * *' | Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month. |
- (Optional) You can delay the start time of a query by enabling the Delay execution.
Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically exported to the specified destination.
Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.
(Optional) You can delay the start time of a query by enabling the Delay execution.
You can also send segment data to the target platform by creating an activation in the Audience Studio.
- Navigate to Audience Studio.
- Select a parent segment.
- Open the target segment, right-mouse click, and then select Create Activation.
- In the Details panel, enter an Activation name and configure the activation according to the previous section on Configuration Parameters.
- Customize the activation output in the Output Mapping panel.

- Attribute Columns
- Select Export All Columns to export all columns without making any changes.
- Select + Add Columns to add specific columns for the export. The Output Column Name pre-populates with the same Source column name. You can update the Output Column Name. Continue to select + Add Columnsto add new columns for your activation output.
- String Builder
- + Add string to create strings for export. Select from the following values:
- String: Choose any value; use text to create a custom value.
- Timestamp: The date and time of the export.
- Segment Id: The segment ID number.
- Segment Name: The segment name.
- Audience Id: The parent segment number.
- + Add string to create strings for export. Select from the following values:
- Set a Schedule.

- Select the values to define your schedule and optionally include email notifications.
- Select Create.
If you need to create an activation for a batch journey, review Creating a Batch Journey Activation.
Within Treasure Workflow, you can specify the use of this data connector to export data.
_export:
td:
database: sample_datasets
+export_to_sailthru:
td>: queries/samples.sql
result_connection: my_sailthru_connection
result_settings:
target: bulk_user
bulk_user_key: email
bulk_user_lists: '"My List": 1'
bulk_user_keys_column: sms, sid
bulk_user_vars_columns: name, dob
bulk_user_ignore_error: true_export:
td:
database: sample_datasets
+export_to_sailthru:
td>: queries/samples.sql
result_connection: my_sailthru_connection
result_settings:
target: user
user_key: email
user_lists: '"My List": 1'
user_keys_column: sms, sid
user_vars_columns: name, dob
user_keys_conflict_resolution: error
user_optout_templates: '"My OptOut Template": 1'
user_ignore_error: true_export:
td:
database: sample_datasets
+export_to_sailthru:
td>: queries/samples.sql
result_connection: my_sailthru_connection
result_settings:
target: bulk_user
bulk_user_key: email
bulk_user_lists: '"My List": 1'
bulk_user_keys_column: sms, sid
bulk_user_vars_columns: name, dob
bulk_user_ignore_error: trueFor more information, see using data connectors in workflow to export data.