Skip to content
Last updated

Sailthru Export Integration From The Command Line

Output result data from TD to Sailthru via CLI (TD Toolbelt).

Prerequisites

  • TD Toolbelt is installed.
  • Basic knowledge and a Sailthru account.

Using the Command-Line to Create Your Connection

You can use the CLI to configure your connection.

td query --database your_database --result configuration query

The following table identifies the configuration keys with descriptions.

Config KeyTypeRequiredDescription
typestringyessailthru
targetstringYesEither “list” or “user”.
api_keystringYesSailthru provided API Key. Unlike result exporting with an established Authentication (using Console’s Query Results Export or Workflow), you have to explicitly specify your API Key in the CLI’s parameters.
api_secretstringYesSailthru provided API Secret. Similar to API Key, you also have to specify your API Secret.
list_namestringYes (for target: “list”)Your destination list name. A new list is created if it doesn’t exist or an existing list updates. You can checklist names on Sailthru.
list_typestringNoSelect 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 updates the existing list to this type. If neither is selected, list type remains as it was previously. See Sailthru for the difference between primary and secondary lists.
list_public_namestringNoThe name that will be presented to your subscribers (i.e. on an opt-out page).
user_keystringYes (for target: user)Select the corresponding type of your id column – email, SMS, sid, extid.
user_ignore_errorbooleanNoIf checked, export jobs still proceed even if a user cannot be created/updated. If left unchecked, jobs terminate if an error record occurs.
user_keys_columnsstringNoAdditional columns (comma separated) that are used to update the user’s keys. The column name has to match the key type exactly.
user_keys_conflict_resolutionstringNo“error” terminates the job if a conflict occurs (i.e. the changed keys match with another that already exists in the Sailthru database). “merge” attempts to resolve the conflicted users with users that have the current id.
user_vars_columnstringNoColumns that are used as additional user’s variables.
user_liststringNoUpdate the Lists that the user belongs to. The value has to conform to the syntax of: `"List Name": 0
user_optout_templatesstringNoSimilar to user_list config, but this is to add/remove users from the opt-out templates.
bulk_user_keystringYes (for target: bulk_user)Select the corresponding type of your id column --email, SMS, sid, extid.
bulk_user_keys_columnsstringNoSimilar to user_keys_columns, but for target: bulk_user
bulk_user_vars_columnstringNoSimilar to user_vars_columns, but for target: bulk_user
bulk_user_listsstringNoSimilar to user_lists, but for target: bulk_user
bulk_user_ignore_errorstringNoSimilar to user_ignore_error, but for target: bulk_user

Example: Outputting Emails to a List

td query --database my_db \
--result '{
           "type": "sailthru",
           "api_key": "xxx"
           "api_secret": "yyy"
           "target": "list",
           "list_name": "My List"
         }' \
'SELECT email from your_table'

Example: Outputting Users

td query --database my_db \
--result '{
    "type": "sailthru",
    "api_key": "xxx",
    "api_secret": "yyy",
    "target": "user",
    "user_key": "email",
    "user_keys_columns": "sms, extid",
    "user_vars_columns": "name, address",
    "user_lists": "\"My List\": 1, \"Other List\": 0",
    "user_key_conflict_resolution": "merge",
    "user_optout_templates": "\"My Template\": 1",
    "user_ignore_error": true
  }' \
'SELECT email as id, sms, extid, name, address from your_table'

Example: Bulk Outputting Users

td query --database my_db \
--result '{
    "type": "sailthru",
    "api_key": "xxx",
    "api_secret": "yyy",
    "target": "user",
    "bulk_user_key": "email",
    "bulk_user_keys_columns": "sms, extid",
    "bulk_user_vars_columns": "name, address",
    "bulk_user_lists": "\"My List\": 1, \"Other List\": 0",
    "bulk_user_ignore_error": true
  }' \
'SELECT email as id, sms, extid, name, address from your_table'

Scheduling Execution

Learn more: