Skip to content
Last updated

Dotdigital Export Integration CLI

You can write job results export directly from Treasure Data to Dotdigital Marketing Solution service.

Prerequisites

  • Basic Knowledge of Treasure Data.
  • Basic knowledge of Dotdigital Unified Contacts

Creating Your Connection from the Command Line

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
typestringYesExport type: dotdigital

region

string

Yes

Available regions:

  • Europe: r1
  • North America: r2
  • Asia Pacific: r3

Site: https://{region}-api.dotdigital.com

usernamestringYesAPI user
passwordstringYesAPI password
modestringYesExport Mode. Supported values:
  • transactional_email
  • bulk_contacts
  • unified_contacts
unified_cts_export_operationstringNoSupported values:
  • upload (default)
  • delete
unified_cts_merge_optionstringNoSupported values:
  • overwrite (default)
  • overwriteIfEmpty
  • overwriteIfNotEmpty
unified_cts_add_to_liststringNoSupported values:
  • false (default)
  • true
unified_cts_list_identifier_modestringNoSupported values:
  • id (default)
  • name
unified_cts_list_idstringNoList id where contacts will be assigned to. Required when unified_cts_list_identifier_mode = id
unified_cts_list_namestringNoList name where contacts will be assigned to. Required when unified_cts_list_identifier_mode = name
unified_cts_create_when_not_foundstringNoSupported values:
  • false (default)
  • true
unified_cts_new_list_visibilitystringNoSupported values:
  • private (default)
  • public
ignore_invalid_recordsbooleanNoIf set to true, this will skip invalid records and continue uploading valid ones. If set to false (default), this will terminate the job when an invalid record is encountered.

Example Query that Exports Unified Contacts: do not add contacts to list

td query --database my_db \
--query 'SELECT match_identifier, contact_id, email, mobile_number, channel_properties, consent_records, firstname, lastname FROM your_table' \
--type presto \
--result '{
  "type":"dotdigital",
  "region":"r1",
  "username":"{api user}",
  "password":"{api password}",
  "mode":"unified_contacts",
  "unified_cts_export_operation":"upload",
  "unified_cts_merge_option":"overwrite",
  "unified_cts_add_to_list":false,
  "ignore_invalid_records":true
}'

Example Query that Exports Unified Contacts: add contacts to list

td query --database my_db \
--query 'SELECT match_identifier, contact_id, email, mobile_number, channel_properties, consent_records, firstname, lastname FROM your_table' \
--type presto \
--result '{
  "type":"dotdigital",
  "region":"r1",
  "username":"{api user}",
  "password":"{api password}",
  "mode":"unified_contacts",
  "unified_cts_export_operation":"upload",
  "unified_cts_merge_option":"overwrite",
  "unified_cts_add_to_list":true,
  "unified_cts_list_identifier_mode":"id",
  "unified_cts_list_id":"{list id}",
  "ignore_invalid_records":true
}'

Example Query that Delete Unified Contacts

td query -d database -w \
--query 'SELECT match_identifier, contact_id, email, mobile_number FROM your_table' \
--type presto \
--result '{
  "type":"dotdigital",
  "region":"r1",
  "username":"{api user}",
  "password":"{api password}",
  "mode":"unified_contacts",
  "unified_cts_export_operation":"delete",
  "ignore_invalid_records":true
}'

See Also