# Salesforce Pardot Export Integration You can use the Salesforce [Pardot](https://www.pardot.com/) 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/](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** > **Pardot** > **Pardot Account Setup.** OR, from Setup, enter "Pardot Account Setup" in the Quick Find box. ![](/assets/image2021-3-31_13-33-35.6bd30abc12c713edb55401b576b622d0d37aff22a9e687ea168e0c7f416f3691.da0a80a2.png) 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](/int/salesforce-pardot-export-integration#h2__1765871400) 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 ![](/assets/salesforce-pardot-export-integration-2024-10-07-1.460b0e91901872734c88cfd8a06d5e0b7ec3b579cccfe826ff627b9b3e07a2b7.da0a80a2.png) 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 Host | If you are using a Production account it would be [https://pi.pardot.com](https://pi.pardot.com). For a Pardot Developer Org or a Sandbox account, it would be [https://pi.demo.pardot.com](https://pi.demo.pardot.com) | | Pardot Business ID | The 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 connection | For 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 ID | For the **Custom Connected App**, refer [here](/int/salesforce-pardot-export-integration#h2__1765871400) to create a Connected App and fill in the `Client ID`, `Client Secret`, `Login URL`, and `Refresh Token` in the corresponding fields | | Client Secret | The Client Secret of your Connected App | | Login URL | The login URL of your Salesforce instance | | Refresh token | The 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** ![](/assets/salesforce-pardot-export-integration-2024-10-07-3.a40359868c9799a3b7f1920a5557af09cb115db2d1d1bbdf5f45e4ea7f0d1714.da0a80a2.png) ### Configuration Parameters | **Field** | **Description** | | --- | --- | | Data Objects | Select the target data object between `Prospects` (default) and `List Memberships` | | Data Objects = **Prospects** | | | Prospect List Operation | The default upload mode is `Batch Upsert` | | List ID | The 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 Operation | Select **Add** or **Remove** to add (or remove) Prospects in (out of) the List ID specified | | Data Objects = **List Memberships** | | | List Memberships Operation | Select **Upsert** or **Delete**. The respective operation will be used as your selection | ### Column Metadata for Prospects Data Object | Column Name | Data Type | Required? | Description | Note | | --- | --- | --- | --- | --- | | id | Integer | ✅ | Pardot ID for this prospect | should be left null in case of inserting new prospects | | fid | String | ✅ | CRM FID if syncing with Salesforce Leads | should be left null in case of inserting new prospects | | email | String | ✅ | Prospect's email address | always required in case of inserting new prospects | | campaign_id | Integer | | Pardot ID of the campaign associated with this prospect | | | salutation | String | | Prospect's formal prefix | | | first_name | String | | Prospect's first name | | | last_name | String | | Prospect's last name | | | password | String | | Prospect's password | | | company | String | | Prospect's company | | | prospect_account_id | Integer | | Prospect's account ID | | | website | String | | Prospect's website URL | | | job_title | String | | Prospect's job title | | | department | String | | Prospect's department | | | country | String | | Prospect's country | | | address_one | String | | Prospect's address, line 1 | | | address_two | String | | Prospect's address, line 2 | | | city | String | | Prospect's city | | | state | String | | Prospect's US state | | | territory | String | | Prospect's territory | | | zip | String | | Prospect's postal code | | | phone | String | | Prospect's phone number | | | fax | String | | Prospect's fax number | | | source | String | | Prospect's source | | | annual_revenue | String | | Prospect's annual revenue | | | employees | String | | Prospect's number of employees | | | industry | String | | Prospect's industry | | | years_in_business | String | | Prospect's number of years in business | | | comments | String | | Comments about this prospect | | | notes | String | | Notes about this prospect | | | score | Integer | | Prospect's score | | | is_do_not_email | Boolean | | If the value is 1, the prospect prefers not to be emailed | | | is_do_not_call | Boolean | | If the value is 1, the prospect prefers not to be called | | | is_reviewed | Boolean | | If the value is 1, the prospect has been reviewed | | | is_starred | Boolean | | If the value is 1, the prospect has been starred | | | is_archived | Boolean | | If the value is 1, the prospect has been archived | | Sample query - Upsert a prospect to a list_xxx ```sql SELECT 'xxx' as id FROM prospect_table -- Or SELECT email FROM prospect_table ``` ### Column Metadata for List Membership Data Object | Column Name | Data Type | Description | Required? | | --- | --- | --- | --- | | prospect_id | Integer | Prospect's ID | ✅ | | list_id | Integer | List's ID | ✅ | Sample query ```sql SELECT list_id, prospect_id FROM (VALUES (xxx, yyyy)) AS table1(list_id, prospect_id); ``` ### Integration Parameters for Salesforce Pardot | Parameter | Values | Description | | --- | --- | --- | | client_id | xxxx | Your connected app's consumer key | | client_secret | xxxx | Your connected app's secret key | | refresh_token | xxxx | Your refresh token obtained after authorizing your connected app | | login_url | https://login.salesforce.com/ | Your Salesforce's login URL | | pardot_domain | https://pi.pardot.com | Your Pardot's domain | | business_unit | 0Uv4xxxxx | Your Business Unit Id | | data_object | prospects | Your target data object must be either prospects or list_memberships | | skip_invalid_records | true | Set this value to true if you would like to skip failed record | | prospect_operation | sync | The operation to send prospects data to Pardot, **sync** is supported | | prospect_lists | xxxx | Comma separate of prospect list ids in case `data_object = prospects` (string) | | prospect_list_operation | add | Operation to add/remove prospects if `prospect_lists` is set. Applicable in case `data_object = prospects` (enum(`add`, `remove`), default: `add`) | | upsert_by_email | false | Upsert propsect using email as key | | parallel_tasks | 1 | Number of tasks to run in parallel when sending prospects data to Pardot | | max_payload | 5000 | 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_operation | upsert | The operation to send list memberships data to Pardot. Must be **upsert** or **delete** | | maximum_retries | 5 | Maximum number of retries when request failed | | initial_retry_wait | 1 | The initial amount of time before the first retry in seconds | | maximum_retry_wait | 120 | The maximum amount of time to wait for a retry in seconds | | maximum_connection_timeout | 300 | Maximum 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. ![](/assets/image2021-1-15_17-28-51.f1b242f6ecc7666a0097fdf37edd1682786ec11ef80eff68c66f091bc405c371.0f87d8d4.png) 4. In the drop-down, select one of the following schedule options: ![](/assets/image2021-1-15_17-29-47.45289a1c99256f125f4d887e501e204ed61f02223fde0927af5f425a89ace0c0.0f87d8d4.png) | Drop-down Value | Description | | --- | --- | | Custom cron... | Review [Custom cron... details](#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. | | None | No schedule. | #### Custom cron... Details ![](/assets/image2021-1-15_17-30-23.0f94a8aa5f75ea03e3fec0c25b0640cd59ee48d1804a83701e5f2372deae466c.0f87d8d4.png) | **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 Value | Example | Example 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. ![](/assets/ouput.b2c7f1d909c4f98ed10f5300df858a4b19f71a3b0834df952f5fb24018a5ea78.8ebdf569.png) - 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 Columns**to 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**. ![](/assets/snippet-output-connector-on-audience-studio-2024-08-28.a99525173709da1eb537f839019fa7876ffae95045154c8f2941b030022f792c.8ebdf569.png) - 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](/products/customer-data-platform/journey-orchestration/batch/creating-a-batch-journey-activation). ## Others - You can use [Scheduled Job](https://docs.treasuredata.com/articles/pd/scheduling-jobs-using-td-console)  with Result Export to periodically upload data to a target destination - You can involve this integration in a [TD workflow](/int/using-td-workflow-with-td-integrations) as part of a more advanced data pipeline ## Using your Custom Connected App A [Connected App](https://help.salesforce.com/articleView?id=sf.connected_app_overview.htm&type=5) 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.** ![](/assets/screen-shot-2021-03-25-at-15.11.20.cf821f43f5944f9c884aba9e5d0a2c029b70481c03777d1ee0869a566a68a18a.da0a80a2.png) 1. Navigate to **Platform Tools** > **Apps.** 2. Select **App Manager**. ![](/assets/screen-shot-2021-03-25-at-15.15.38.c724dba603815a0c8d9b856aca5eed484ec417f56209d53fd03297326cc7b11e.da0a80a2.png) 1. Select on **New Connected App**. ![](/assets/screen-shot-2021-03-25-at-15.16.28.82a23e565c1ac3a037c1a6048d3adac0badd24509b4af8c69f5c46b4463fa67a.da0a80a2.png) 1. Type the required information in **Basic information** ![](/assets/screen-shot-2021-03-25-at-15.18.00.3838a21b710346b674a14af89ea01916eba2360396404e689f9e001aec9a6b4c.da0a80a2.png) 1. Select **Enable OAuth Settings**. ![](/assets/screen-shot-2021-03-25-at-15.20.51.3a0f1c97a434439970623e8bc16487dcd1db70cc6b7eccd8b3487cfe085ce056.da0a80a2.png) - 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** ![](/assets/screen-shot-2021-03-25-at-15.40.47.973cc4413bf2b0db897430160dde9eaa29fc521084fccb22b08a2421c9acd87c.da0a80a2.png) 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 ```bash 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 ```json { "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.