You can use the Salesforce Pardot to send job results (in the form of prospects or list memberships) from Treasure Data directly to Salesforce Pardot to sync up your CRM data.

Pardot offers marketing automation to help marketing and sales teams find and nurture leads, close more deals, and maximize ROI.


This Data Connector is in Beta. For more information, contact support@treasuredata.com.


Prerequisites

  • Basic Knowledge of Treasure Data.

  • Basic knowledge of Salesforce Pardot models

  • A working Salesforce Pardot account
  • Your Business Unit ID. 

Supported

We support sending data to Prospect or List Memberships in Salesforce Pardot.

We support parallel prospects upsert. Use this feature whenever you would like to speed up the execution of your jobs by increasing the number of parallel tasks. But please be aware of your account's concurrent calls limit.

Requirements and Limitations

Customers have an adequate Salesforce Pardot plan (Pro or Ultimate) in order to use the connector.

For Prospects, due to the API, Treasure Data only supports a URI length to a certain length, then we add a restriction if a row contains data that is greater than 7500 characters in length (after serialized as JSON) will be considered an invalid record.

For List Membership, opting out prospects is not supported because it is a one-way action and can not be reverted.

The connector adheres to all Pardot API limits below:

  • The daily Pardot API call limit and the concurrent Pardot API call limit apply to Import API calls just as they would any other Pardot API calls.

Column names in your export results must be in a lower letter case and strictly follow Pardot field names of each data object (case sensitivity).

Obtain the Pardot Business Unit ID

To find the Pardot Business Unit ID, use Setup in Salesforce. 

Your Pardot Business Unit ID begins with "0Uv" and is 18 characters long.

If you cannot access the Pardot Account Setup information, ask your Salesforce Administrator to provide you with the Pardot Business Unit ID. https://developer.pardot.com/kb/authentication/.

Authenticating with Pardot requires entering your Business Unit ID. 

1. Log into Salesforce using the same account you use to log into Pardot.

2. Navigate to Setup > PardotPardot Account Setup.  OR, from Setup, enter "Pardot Account Setup" in the Quick Find box.

3. You may have multiple Pardot business units. 
Your Pardot Business Unit ID begins with "0Uv" and is 18 characters long.

Define your Custom Connected App

A custom connected app, the correct authorization, and the refresh token are all required to define your Pardot authorization within Treasure Data. 

See the Using your Custom Connected App instructions at the end of this HTML page. 

Use the TD Console to Create Your Connection

Create a New Connection

In Treasure Data, you must create and configure the data connection prior to running your query. As part of the data connection, you provide authentication to access the integration.

1. Open TD Console.
2. Navigate to Integrations Hub Catalog.
3. Search for and select Salesforce Pardot.

4. Select Create Authentication.

5.  Enter values for the following parameters:


  1. Select Click here.
  2. Login to your Salesforce app.
  3. Select Allow.


    You are redirected to TD Console.

  4. Navigate to Integrations Hub Catalog.

  5. Search for and select Salesforce Pardot.

  6. Confirm that your connection is displayed in the OAuth connection field.



You could use your Custom Connected App if your Salesforce login site is different than https://login.salesforce.com or if you have trouble authenticating using the Treasure Data Connected App option.  

  1. Select Custom Connected App.

  2. Enter your connected app's Client ID.
  3. Enter your connected app's Client Secret.
  4. Enter your connected app's Login URL.
  5. Enter your Refresh Token.


6. Select Continue.
7. Type a name for your connection.
8. Select Done.



Configure Output Target Data Object

We support sending data to Prospect or List Memberships in Salesforce Pardot.

Configure Output Data To Prospects Data Object


1.  Open the TD Console.
2.  Navigate to Data Workbench > Queries.
3.  Select the query that you plan to use to export data.
4. Select Export Results.

5.  Choose Use Existing Integration
6.  Select your saved connection name in previous steps

7. Select Prospects. 

8. Input the List ID you want for your Prospects to be added to in Pardot (can be a single List ID or comma-separated string of List ID).
9. Select Add or Remove in the Prospect List Operation to add or remove Prospects in or out of the List ID you have specified.
10.  Select Upserting prospects by emails if you want to export only email as the primary key when upserting prospects. 
11. Configure the number of Concurrent API Calls within the limit of your Pardot plan for parallel processing.
12. The rest of the parameters have default recommended values for the connector. However, when there are exceptions, adjust the values accordingly to avoid failed jobs. For example: Depends on the Pardot server to change Maximum Payload from default 5000 characters to 4000 characters if the job failed by 404 error "Request URI is too long".

13. Click Done

Configure Output Data To List Membership Data Object


1.  Open the TD Console.
2.  Navigate to Data Workbench > Queries.
3.  Select the query that you plan to use to export data.
4. Select Export Results.

5.  Select Use Existing Integration.
6.  Select your saved connection.

7. Select List Memberships to export your data from Treasure Data audience segments to Pardot. 

8. Select Upsert or Delete. The respective operation will be used as your selection.
9. The rest of the parameters have default recommended values for the connector.
However, when there are exceptions, adjust the values accordingly to avoid failed jobs. For example: Depends on the Pardot server to change Maximum Payload from default 5000 characters to 4000 characters if the job failed by 404 error "Request URI is too long".
10.  Select Done.


Define your Query

You need to define the column mapping in the query. The columns in the query represent Prospects or List Memberships fields to be imported into Salesforce Pardot.

Depending on your data object, you will need different column mapping.


  1. Complete the instructions in Creating a Destination Integration.
  2. Navigate to Data Workbench > Queries.

  3. Select a query for which you would like to export data.

  4. Run the query to validate the result set.

  5. Select Export Results.

  6. Select an existing integration authentication.
  7. Define any additional Export Results details. In your export integration content review the integration parameters.
    For example, your Export Results screen might be different, or you might not have additional details to fill out:
  8. Select Done.

  9. Run your query.

  10. Validate that your data moved to the destination you specified.

Salesforce Paradot Column Mapping 

Column Metadata for Prospects Data Object

Column NameData TypeRequired?DescriptionNote
idIntegerPardot ID for this prospectshould be left null in case of inserting new prospects
fidStringCRM FID if syncing with Salesforce Leadsshould be left null in case of inserting new prospects
emailStringProspect's email addressalways required in case of inserting new prospects
campaign_idInteger
Pardot ID of the campaign associated with this prospect
salutationString
Prospect's formal prefix
first_nameString
Prospect's first name
last_nameString
Prospect's last name
passwordString
Prospect's password
companyString
Prospect's company
prospect_account_idInteger
Prospect's account ID
websiteString
Prospect's website URL
job_titleString
Prospect's job title
departmentString
Prospect's department
countryString
Prospect's country
address_oneString
Prospect's address, line 1
address_twoString
Prospect's address, line 2
cityString
Prospect's city
stateString
Prospect's US state
territoryString
Prospect's territory
zipString
Prospect's postal code
phoneString
Prospect's phone number
faxString
Prospect's fax number
sourceString
Prospect's source
annual_revenueString
Prospect's annual revenue
employeesString
Prospect's number of employees
industryString
Prospect's industry
years_in_businessString
Prospect's number of years in business
commentsString
Comments about this prospect
notesString
Notes about this prospect
scoreInteger
Prospect's score
is_do_not_emailBoolean
If the value is 1, the prospect prefers not to be emailed
is_do_not_callBoolean
If the value is 1, the prospect prefers not to be called
is_reviewedBoolean
If the value is 1, the prospect has been reviewed
is_starredBoolean
If the value is 1, the prospect has been starred
is_archivedBoolean
If the value is 1, the prospect has been archived

Sample query

Upsert a prospect to a list_xxx, the query will be: 
SELECT 'xxx' as id FROM prospect_table
Or
SELECT email from prospect_table

Column Metadata for List Membership Data Object

Column NameData TypeDescriptionRequired?
prospect_idIntegerProspect's ID
list_idIntegerList's ID

Sample query

SELECT list_id, prospect_id FROM (VALUES (xxx, yyyy)) FROM table1 (list_id, prospect_id)

Integration Parameters for Salesforce Pardot

ParameterValuesDescription
client_idxxxxYour connected app's consumer key
client_secretxxxxYour connected app's secret key
refresh_tokenxxxxYour refresh token obtained after authorizing your connected app
login_urlhttps://login.salesforce.com/Your Salesforce's login URL
pardot_domain

https://pi.pardot.com

Your Pardot's domain
business_unit0Uv4xxxxxYour Business Unit Id
data_objectprospectsYour target data object must be either prospects or list_memberships
skip_invalid_recordstrueSet this value to true if you would like to skip failed record
prospect_operationsyncThe operation to send prospects data to Pardot, sync is supported
prospect_listsxxxxComma separate of prospect list ids in case `data_object = prospects` (string)
prospect_list_operationaddOperation to add/remove prospects if `prospect_lists` is set. Applicable in case `data_object = prospects` (enum(`add`, `remove`), default: `add`)
upsert_by_emailfalseUpsert propsect using email as key
parallel_tasks1Number of tasks to run in parallel when sending prospects data to Pardot
max_payload5000

Payload size when sending prospects data to Pardot.

This is a parameter for fine-tuning for each Pardot instance, they will have a different max URI configured.

Whenever you reach the error 414 Request-URI Too Long when sending prospects then please lower this value.

Otherwise, the default value is enough.

list_membership_operationupsertThe operation to send list memberships data to Pardot. Must be upsert or delete
maximum_retries5Maximum number of retries when request failed
initial_retry_wait1The initial amount of time before the first retry in seconds
maximum_retry_wait120The maximum amount of time to wait for a retry in seconds
maximum_connection_timeout300Maximum connection time for a request to Pardot

Optionally Schedule the Query Export Jobs

You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.


1. Navigate to Data Workbench > Queries.
2. Create a new query or select an existing query.
3. Next to Schedule, select None.

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

Drop-down ValueDescription
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.
NoneNo schedule.

Custom cron... Details

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 ValueExampleExample 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.
5.  (Optional) You can delay the start time of a query by enabling the Delay execution.

Execute the Query

Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically imported to the specified container destination.

Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.


Optionally Configure Export Results in Workflow

Within Treasure Workflow, you can specify the use of this data connector to export data.

Learn more at Using Workflows to Export Data with the TD Toolbelt.

Example Workflow for Salesforce Pardot 


timezone: UTC

_export:
  td:
    database: sample_datasets

+td-result-into-target:
  td>: queries/sample.sql
  result_connection: salesforce_pardot
  result_settings:
    data_object: prospects
    prospect_operation: sync
    prospect_lists: xxxx
    prospect_list_operation: add
    upsert_by_email: true
    parallel_tasks: x
    skip_invalid_records: true
    max_payload: 5000
    maximum_retries: 5
    initial_retry_wait: 1
    maximum_retry_wait: 120
    maximum_connection_timeout: 300

Using your Custom Connected App

To integrate with your Pardot account, you will need a Connected App created by Treasure Data or yourself.

The connected app created by you is called a custom connected app.

Optionally, you could use our default connected app.

If you use a custom domain name for your Salesforce instances or your login URL is not https://login.salesforce.com then a custom connected app is required.

Define Your Connected App

1. Login to your Salesforce Lightning Experience.
2. Select the gear icon. 
3. Select Setup.

4. Navigate to Platform Tools > Apps.
5. Select App Manager.


6. Select on New Connected App.


7. Type the required information in Basic information.


8. Select Enable OAuth Settings.


9. Navigate to API (Enable OAuth Settings) > Callback URL.
10. Type http://localhost:8080.
11. Navigate to API (Enable OAuth Settings) > Selected OAuth Scopes.
12. You MUST select Access Pardot services (pardot_api) and Perform requests on your behalf at any time (refresh_token, offline_access).

13. Scroll to the end.

14. Select Save.
15. Select Continue.

16. Write down the Consumer Key (this will be your Client ID).

17. Select Click to reveal to get your Consumer Secret. 
18. Write down (this will be your Client Secret).


Authorize Your App to Access your Salesforce Pardot Account

Open a web browser and type in the following:

https://{YOUR_SALESFORCE_LOGIN_URL}/services/oauth2/authorize?client_id={YOUR_CONSUMER_KEY}&redirect_uri=http://localhost:8080&response_type=code

YOUR_SALESFORCE_LOGIN_URL: {Your salesforce login url - i.e https://login.salesforce.com}
YOUR_CONSUMER_KEY: {The consumer key you got in create connected app step}

An example of full URL: https://login.salesforce.com/services/oauth2/authorize?client_id=xxxxxx&redirect_uri=http://localhost:8080&response_type=code


1. Log in to your account.
2. Select Allow.



3. You are redirected to a non-existing page.


4. Copy the URL and select the text after code= and replace %3D with =
http://localhost:8080/?code=xxxx%3D%3D

For example xxxx== this is the code to get refresh token.



Obtain a Refresh Token


  1. Open the Postman tool.


  2. Create a request. For example:

    With:




  3. Select Send.



Alternative you could use cUrl


curl --location --request POST 'https://{your_salesforce_login_url}/services/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'code=your_code' \
--data-urlencode 'client_id=client_id' \
--data-urlencode 'client_secret=client_secret' \
--data-urlencode 'redirect_uri=http://localhost:8080'

After sending the request you will receive a response like below

{
    "access_token": "xxxxx",
    "refresh_token": "xxxx",
    "signature": "xxxx",
    "scope": "refresh_token pardot_api",
    "instance_url": "xxxx",
    "id": "xxx",
    "token_type": "Bearer",
    "issued_at": "1616662486135"
}

The value in refresh_token is your Refresh Token used in the Authentication screen.



  • No labels