Skip to content
Last updated

Marketo Export Integration

Learn more about Marketo Import Integration.

You can create a connector to write Treasure Data job results directly to your Marketo account records. The TD query job results add users, such as appending to Marketo Target lists or updating existing users.

For sample workflows of exporting to Marketo, view Treasure Boxes.

Prerequisites

  • Basic knowledge of Treasure Data, including the TD Toolbelt.
  • A Marketo Account with API access enabled (done via Marketo Console).

Create a New Connection

  1. Go to Integrations Hub > Catalog. Select Marketo.

  1. The dialog opens.

  1. Complete the new connection information, providing your Marketo credential:
  • Marketo Account ID (required): Your Marketo Service/Munchkin ID.
  • Marketo Client ID (required): A service-specific client ID.
  • Marketo Client Secret (required): A service-specific client secret.
  1. Enter the name of your newly created connection and select Done.

Configure to Output Results to Marketo Connection

  1. Check the output results at the top of your query editor and select your Marketo connection.

There are several parameter fields to complete.

ParameterTypeRequired?Description
ModestringyesThe connector mode could be upload_leads  or delete_leads. Default is upload_leads.
Marketo Target List IDstringyesThe ID of the list is where the new leads are imported. The list must be from an existing list; otherwise, the new leads will go into the central Marketo database.
Headers for importing datastringnoSpecify headers as export target field. In addition to the query, specify the field name here.
Marketo Partition NamestringnoName of the partition to which the new leads will belong.
Lookup FieldstringnoThe value in this field is bound to this data set and can be used to look up or de-dup the data set. The default is email.
Retry limitintegernoThe number of retries before the connector stops trying to connect and send data. The retry limit default is six.
Retry initial wait in millisecondsintegernoThe interval to retry if a recoverable error happens (in milliseconds). The default is 1000.
Retry Max wait in millisecondsintegernoThe maximum time in milliseconds between retry attempts. The default is 30000.
Max HTTP waiting time in millisecondsintegernoThe maximum HTTP wait time. The default is 3000000.
Max upload chunk size (in bytes)integernoThe maximum chunk size to upload. The default is 10000000.
Batch max wait in millisecondsintegernoThe Maximum batch waiting time. The default is 3600000.
Ignore Invalid RecordsbooleannoIgnore invalid records during deletion. The default is false.
Skip Invalid RecordsbooleannoIgnore invalid records during upload data. The default is true.

Sample Configuration

The list ID is available on the Marketo Console:

Activate a Segment in Audience Studio

You can also send segment data to the target platform by creating an activation in the Audience Studio.

  1. Navigate to Audience Studio.
  2. Select a parent segment.
  3. Open the target segment, right-mouse click, and then select Create Activation.
  4. In the Details panel, enter an Activation name and configure the activation according to the previous section on Configuration Parameters.
  5. 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.
  1. Set a Schedule.

  • Select the values to define your schedule and optionally include email notifications.
  1. Select Create.

(Optional) Export Integration Using the CLI

The TD Toolbelt can trigger exporting the Query Result to Marketo from the CLI. You need to specify the parameters for the export job using the --result option of the td query command. For more information, refer to Querying and Importing Data to Treasure Data from the Command Line.

The format of the option is JSON, and the general structure is as follows:

For upload lead mode

{"type": "marketo",  "account_id": "account id",  "client_id": "client id",  "client_secret": "client secret",  "mode": "upload_leads",  "list_id": "list id",  "batch_max_wait_msec": 3600000,  "upload_chunk_size_in_bytes": 10000000,  "retry_limit": 7,  "retry_initial_wait_msec": 1000,  "max_retry_wait_msec": 32000,  "http_timeout_millis": 300000,  "skips_invalid_records": true}# For delete mode{  "type": "marketo",  "account_id": "account id",  "client_id": "client id",  "client_secret": "client secret",  "mode": "delete_leads",  "list_id": "list id",  "batch_max_wait_msec": 3600000,  "upload_chunk_size_in_bytes": 10000000,  "retry_limit": 7,  "retry_initial_wait_msec": 1000,  "max_retry_wait_msec": 32000,  "http_timeout_millis": 300000,  "ignore_invalid_records": false}

CLI Parameters.

ParameterTypeRequired?Description
typestringyesExport type. It must be the exact value of "marketo."
account_idstringyesA specific Marketo Munchkin ID is needed for this service/account.
client_idstringyesClient ID. Available from the Marketo console.
client_secretstringyesClient secret. Available from the Marketo console.
modestringyesThe connector mode could be upload_leads or delete_leads.
list_idstringyesThe ID of the list is where the new leads are imported. The list must be from an existing list; otherwise, the new leads will go into the central Marketo database.
file_formatstringnoFile format to be used. The default format is CSV
headersstringnoSpecify headers as export target field. In addition to the query, specify the field name here.
partition_namestringnoName of the partition to which the new leads will belong.
lookup_fieldstringnoThe value in this field is bound to this data set and can be used to look up or de-dup the data set. The default is email.
retry_limitintegernoThe number of retries before the connector stops trying to connect and send data. The retry limit default is six.
retry_initial_wait_msecintegernoThe interval to retry if a recoverable error happens (in milliseconds). The default is 1000.
max_retry_wait_msecintegernoThe maximum time in milliseconds between retry attempts. The default is 30000.
http_timeout_millisintegernoThe maximum HTTP wait time. The default is 3000000.
upload_chunk_size_in_bytesintegernoThe maximum chunk size to upload. The default is 10000000.
batch_max_wait_msecintegernoThe Maximum batch waiting time. The default is 3600000.
ignore_invalid_recordsbooleannoIgnore invalid records during deletion. The default is false.
skip_invalid_recordsbooleannoIgnore invalid records during upload data. The default is true.

Examples

td query -d [database] -w 'SELECT id, email, company FROM marketo' --type presto --result '{"type":"marketo", "account_id”:”[account id]”, "client_id”:”[client id]”, "client_secret”:”[client secret]”, "mode":"upload_leads", "list_id”:”[list id]”, "retry_limit": 3}';

Write the Query to Populate a Leads List

On TD Console, run the following query  Output results into a connection with Marketo. The query does not match any real users and is for demonstration purposes only. For more details on column naming, see the Appendix.

SELECT
  td_global_id as tdglobalid,
  firstname,
  lastname,
  email,
  company
FROM (
  VALUES
    ('b1b065f5-1222-4a14-b151-379d49ec39e3', 'John', 'Doe', 'name+test1@treasure-data.com', 'Marketo Dummy Lead - DO NOT USE'),
    ('x1b065f5-1222-4a14-b151-379d49ec39e3', 'Janes', 'Doe', 'name+test2@treasure-data.com', 'Marketo Dummy Lead - DO NOT USE'),
    ('p1b065f5-1222-4a14-b151-379d49ec39e3', 'Tony', 'Doe', 'name+test3@treasure-data.com', 'Marketo Dummy Lead - DO NOT USE'),
    ('o1b065f5-1222-4a14-b151-379d49ec39e3', 'Bill', 'Adam', 'name+test4@treasure-data.com', 'Marketo Dummy Lead - DO NOT USE'),
  ('t1b065f5-1222-4a14-b151-379d49ec39e3', 'Dan', 'Steve', 'name+test5@treasure-data.com', 'Marketo Dummy Lead - DO NOT USE')
) tbl
  (
    td_global_id,
    firstname,
    lastname,
    email,
    company
)

The demo query requires no source table (for the ease of testing this feature), but you must choose your database, so pick “sample_datasets” or any other arbitrary table.

If you don’t want to specify the data headers in the configuration, you can use aliases in your query to rename columns of your query result.

Example

SELECT
  an_email_column AS EMAIL,
  another_phone_column AS PHONE
FROM
  your_table;

In the previous code sample, we are creating a new data set with headers of EMAIL and PHONE.

Column names are case-insensitive. For example, you can use either email or EMAIL.

The query should be completed in a few seconds. When complete, check the Marketo Console for your new leads:

Appendix

Marketo Leads Data

Output result data must follow Marketo data specifications.

For example, when the field is set up as an Integer, the data Treasure Data sends to Marketo must be convertible to int (1001aa is not a valid integer).

Munchkin Account Information

Access to your API-enabled account is required before uploading the Marketo list. The Munchkin Account ID can be retrieved from the Marketo Admin page.

Steps to enable and create a new account for API access

  1. Create an API-Only User.
  2. Create an API-Only User Role.
  3. Enable the Advanced List Import Permission on a Role.
  4. Create a Custom Service for Use with REST API.
  5. Check the endpoint for Rest API on the “Web Service” menu. There, you can find a client ID and a client secret for using the API.

Preparing Data for Marketo Leads - Reference