Skip to content
Last updated

Salesforce Pardot Export Integration

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.

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 call limit.

Requirements and Limitations

Customers need an adequate Salesforce Pardot plan (Pro or Ultimate) 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 of 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 the 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 instruction at the end of this HTML page.

Create a New Connection

On TD Console, you must create and configure the data connection before running your query. As part of the data connection, you provide authentication to access the integration following the below steps

  1. Open TD Console.
  2. Navigate to Integrations Hub > Catalog.
  3. Search for and select Salesforce Pardot.
  4. Select Create Authentication, and provide the credential information for the integration as described below.
  5. Select Continue, enter a name for the Authentication, and select Done.

Authentication Fields

Field Description
Pardot HostIf you are using a Production account it would be https://pi.pardot.com. For a Pardot Developer Org or a Sandbox account, it would be https://pi.demo.pardot.com
Pardot Business IDThe Pardot Business Unit ID
Connected App
  • (Default). Treasure Data Connected App: authorize the TD App to upload data by providing an OAuth in the OAuth connection field
  • Custom Connected App: use your own Connected App by providing a Client ID, Client Secret, Login URL, and Refresh Token
OAuth connectionFor the Treasure Data Connected App, select Click here and follow the authorization flow to provide your OAuth. You may need to navigate to the Integrations Hub Catalog and search for the Salesforce Pardot to continue.
Client IDFor the Custom Connected App, refer here to create a Connected App and fill in the Client ID, Client Secret, Login URL, and Refresh Token in the corresponding fields
Client SecretThe Client Secret of your Connected App
Login URLThe login URL of your Salesforce instance
Refresh tokenThe refresh token after authorizing the custom app

Configure a Query Result for Export

The TD Console supports multiple ways to export data. Please follow the below steps to export data from the Data Workbench

  1. Navigate to Data Workbench > Queries
  2. Select New Query, and define your query
  3. Select Export Results to configure the data exporting
  4. Select an existing Pardot authentication, or create a new one following the above section
  5. Configure the exporting parameters as described below, and select Done

Configuration Parameters

FieldDescription
Data ObjectsSelect the target data object between Prospects (default) and List Memberships
Data Objects = Prospects
Prospect List OperationThe default upload mode is Batch Upsert
List IDThe List ID that Prospects will be added (or removed) into. It could be a single List ID or comma-separated string of List ID
Prospect List OperationSelect Add or Remove to add (or remove) Prospects in (out of) the List ID specified
Data Objects = List Memberships
List Memberships OperationSelect Upsert or Delete. The respective operation will be used as your selection

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_idIntegerPardot ID of the campaign associated with this prospect
salutationStringProspect's formal prefix
first_nameStringProspect's first name
last_nameStringProspect's last name
passwordStringProspect's password
companyStringProspect's company
prospect_account_idIntegerProspect's account ID
websiteStringProspect's website URL
job_titleStringProspect's job title
departmentStringProspect's department
countryStringProspect's country
address_oneStringProspect's address, line 1
address_twoStringProspect's address, line 2
cityStringProspect's city
stateStringProspect's US state
territoryStringProspect's territory
zipStringProspect's postal code
phoneStringProspect's phone number
faxStringProspect's fax number
sourceStringProspect's source
annual_revenueStringProspect's annual revenue
employeesStringProspect's number of employees
industryStringProspect's industry
years_in_businessStringProspect's number of years in business
commentsStringComments about this prospect
notesStringNotes about this prospect
scoreIntegerProspect's score
is_do_not_emailBooleanIf the value is 1, the prospect prefers not to be emailed
is_do_not_callBooleanIf the value is 1, the prospect prefers not to be called
is_reviewedBooleanIf the value is 1, the prospect has been reviewed
is_starredBooleanIf the value is 1, the prospect has been starred
is_archivedBooleanIf the value is 1, the prospect has been archived

Sample query

  • Upsert a prospect to a list_xxx
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)) AS table1(list_id, prospect_id);

Integration Parameters for Salesforce Pardot

Parameter Values Description
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_domainhttps://pi.pardot.comYour 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_payload5000Payload 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

(Optional) Schedule Query Export Jobs

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.

Scheduling your Job Using TD Console

  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 ValueDescription
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.
  1. (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 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.

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.

If you need to create an activation for a batch journey, review Creating a Batch Journey Activation.

Others

  • You can use Scheduled Job  with Result Export to periodically upload data to a target destination
  • You can involve this integration in a TD workflow as part of a more advanced data pipeline

Using your Custom Connected App

A Connected App is required to integrate into your Pardot account. TD has prepared a Connected App for your convenience, but you could create one for the purpose. 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.

  1. Navigate to Platform Tools > Apps.

  2. Select App Manager.

  1. Select on New Connected App.

  1. Type the required information in Basic information

  1. Select Enable OAuth Settings.

  • Navigate to Callback URL and type http://localhost:8080
  • Navigate to Selected OAuth Scopes, and select Access Pardot services (pardot_api)and Perform requests on your behalf at any time (refresh_token, offline_access).
  • Scroll to the end, select Save and select Continue
  1. Select Copy to copy the Consumer Key and the Consumer Secret, which will be used for Client ID and Client Secret respectively.

Authorize Your App to Access your Salesforce Pardot Account

  1. 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 a 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, and select Allow

  1. You will be redirected to a non-existing page, let select the URL and copy the text after code= and replace %3D with =

For example, in the URL http://localhost:8080/?code=xxxx%3D%3D, the **xxxx==**is the code to get a refresh token in the next step.

Obtain a Refresh Token

Use CURL in a terminal with the code from the step above to request a refresh token

curl --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.