You can connect Salesforce with Treasure AI for greater control over your Salesforce data and better integration with the other business applications in your marketing and sales operations stack.
Integrating Salesforce with Treasure AI makes it easy to:
- Add new features to Salesforce. For example, you can prevent churn by tracking web usage and receiving alerts when customers' product usage declines.
- Use Salesforce data to improve other parts of your marketing stack. For example, you can increase your Facebook Ads ROI by automatically removing new customers from your Facebook Custom Audiences.
For sample workflows on importing data from Salesforce, go to Treasure Boxes.
If you don't have a Treasure account, contact us so we can set you up.
- SOQL: This configuration allows a custom SOQL (Salesforce Object Query Language) to query and filter data. With SOQL, you can retrieve the data from a single object or multiple objects that are related to each other. You can pick specific columns and filter or sort the output with your conditional statement. As a limitation, our data connector doesn't support SOQL syntax such as count() FROM Object and SELECT * from salesforceObject.
- Bulk API limits: Bulk API 1.0 queries consume Salesforce's shared allocation of 15,000 batches per rolling 24 hours. Bulk API 2.0 query jobs do not consume that allocation, but have separate query-job and result-storage limits. Selecting Bulk API 2.0 for imports does not change the quota usage of other integrations or Salesforce exports. See the Salesforce Bulk API Developer Guide.
- SOQL with ORDER BY or LIMIT: Use REST API for queries with
LIMITunder Bulk API 1.0. Bulk API 2.0 supports user-specifiedORDER BYandLIMIT, but either clause disables Salesforce's automatic primary-key chunking and can cause large queries to time out. For eligible Bulk API 2.0 incremental imports, the connector does not add anORDER BYclause. - OAuth: OAuth doesn't support custom domains. Thus if you are using a custom domain, please use credentials as the authentication method.
The Salesforce import connector supports Bulk API 1.0, Bulk API 2.0, and REST API. Bulk API version (bulk_api_version) selects the Salesforce Bulk API generation, not the connector version: the connector type remains sfdc_v2 for both v1 and v2. Existing configurations that omit this setting continue to use v1 for Bulk-compatible queries.
| Behavior | Bulk API 1.0 (v1, default) | Bulk API 2.0 (v2) | REST API |
|---|---|---|---|
| Fetching records | Connector-managed ID chunking and batches | One query job with Salesforce-managed chunking and paginated CSV results | Synchronous queries with pagination |
attributes column | Existing schema behavior is unchanged | Not included in the import schema. If the destination table already has this column, newly imported rows have NULL in it | Salesforce metadata includes the object type and API request URI |
| Properties inside relationship JSON columns | Keep the JSON types returned by Salesforce | Non-null scalar properties are always JSON strings, including numeric and boolean values | Keep the JSON types returned by Salesforce |
| Top-level numeric, boolean, and timestamp columns | Use the configured or inferred schema types | Use the configured or inferred schema types; they are not forced to strings | Use the configured or inferred schema types |
Bulk API 2.0 does not synthesize attributes metadata. An existing destination table can retain the column, but it is NULL for new Bulk API 2.0 rows. When appending, older rows retain their existing values. Relationship JSON properties also change type: for example, {"NumberOfEmployees": 10, "IsDeleted": false} becomes {"NumberOfEmployees": "10", "IsDeleted": "false"}. Null values remain null, and nested objects remain objects. Update downstream queries that depend on attributes or numeric/boolean JSON properties, and cast extracted JSON values as needed.
Preview and schema sampling use REST API even when you select v2. Previewed relationship values can therefore have different JSON types from the values imported by Bulk API 2.0. Datetime text can also differ if you import it as a string: Bulk API 2.0 retains the Z UTC suffix, whereas REST uses +0000; timestamp columns represent the same instant.
Use synchronous transfer only (use_rest: true) overrides the Bulk API selection. The connector also falls back to REST for compound fields such as addresses or geolocation, unsupported objects, aggregate functions, GROUP BY, OFFSET, or a custom SOQL FROM object that differs from the configured source. Selecting the Name field alone does not trigger the compound-field fallback. With v2, TYPEOF and parent-to-child subqueries also use REST; child-to-parent relationships remain supported. These REST imports retain REST metadata and JSON types. Check the job logs to confirm which API actually ran.
For command-line configuration, see Salesforce Import Integration CLI. The batch_size setting applies only to Bulk API 1.0, not Bulk API 2.0 or REST.
SFDC import supports these authentication types:
- Credentials (Deprecated)
- Enabled username & password flow: SETTINGS → Identity → OAuth and OpenID Connect Settings → Allow OAuth Username-Password Flows (turn it on)
- OAuth Policies: PLATFORM TOOLS → App → Connected Apps → Manage Connected Apps → Choose App → Edit Policies → Permitted Users (selected: All users may self-authorize)
- This method is deprecated. Salesforce External Client Apps (ECA) do not support the Username-Password OAuth flow. Migrate to Client Credentials or OAuth.
- OAuth
- Client Credentials (Recommended for External Client Apps)
- Uses OAuth 2.0 Client Credentials Flow. Requires only
client_idandclient_secret. No username, password, or security token needed.
- Uses OAuth 2.0 Client Credentials Flow. Requires only
Using Session ID for authentication is not supported for import.
The Session ID is supported only for Salesforce Export Integration.
Connecting to Salesforce using the Treasure Console is quick and easy. Alternatively, you can create a Salesforce connection using the command line. The import integration supports Client Credentials; you need a client ID and client secret to authenticate using Client Credentials.
This is the guide for Lightning Experience UI.
These instructions guide you to set up an External Client App (ECA) on Salesforce to use the Client Credentials Flow.
- Go to Setup > Apps > External Client Apps > External Client App Manager.
- Add new or edit your app.
- In the Settings tab, click Edit.
- Expand OAuth Settings.
- Add the required OAuth Scopes.
- Check Enable Client Credentials Flow.
- Click Save.

- In the Policies tab, click Edit.
- Expand OAuth Policies.
- Check Enable Client Credentials Flow.
- Fill in Run As (Username) — this is the Salesforce user the integration will run as.
- Click Save.

After saving, note your app's Consumer Key (client_id) and Consumer Secret (client_secret) from the Settings tab — you will need these to configure the connection in Treasure AI.
These instructions guide you to locate the client ID and client secret necessary to authenticate using credentials.
Go to Setup > Apps > App Manager.
Select New Connected App.
Set some values and check to Enable OAuth Settings. Then, grant OAuth permission scope.

Click Save. Activation can take up to 10 minutes.
Go to Setup > Apps > App Manager.
Locate the connected app, click ▼, and then select View.

Write down or copy your Consumer Key (client_id) and Consumer Secret (client_secret).

- Open Treasure Console.
- Navigate to Integrations Hub > Catalog and search for Salesforce
- Choose one of the following:
- Select Client Credentials as the authentication method.
- Enter your Client ID and Client Secret from your External Client App.
- In the Login URL field, enter your Salesforce My Domain URL (for example,
https://yourorg.my.salesforce.com). The generichttps://login.salesforce.comURL is not supported for Client Credentials Flow. See Salesforce OAuth 2.0 Client Credentials Flow for details.

To validate the user permission, make sure to use Salesforce to validate the following:
- Authority: check the Salesforce import integration connection steps.
- Allowed access to Salesforce from Treasure AI: sometimes configuring this requires knowing and configuring your Treasure AI static IP address. Contact support if you need the static IP address information.
Without properly configured authority and access, you might encounter access restriction errors. For example:
Response not 2xx:
400 Bad Request {"error":"invalid_grant","error_description":"authentication failure"}Learn more about Object and Field Permissions for Salesforce CRM in Data Cloud.
After creating the authenticated connection, you are automatically taken to Authentications.
Search for the connection you created.
Select New Source.
Type a name for your Source in the Data Transfer field.

Click Next.
Edit the following parameters:

| Parameters | Description |
|---|---|
| Source | Name of the object you want to import |
| Include deleted records | Enables including deleted records |
| Use synchronous transfer only | Enables synchronous transfer using REST API, overriding the Bulk API version |
| Bulk API version | Select Bulk API 1.0 (v1, default) or Bulk API 2.0 (v2). This option is hidden when Use synchronous transfer only is enabled |
| Incremental | Imports only new data since the last import |
Select Next. The Data Settings page opens.
You can edit the SOQL query, WHERE conditions, and Schema settings here.
Optionally, skip this page of the dialog.

You can see a preview of your data before running the import by selecting Generate Preview. Data preview is optional and you can safely skip to the next page of the dialog if you choose to.
- Select Next. The Data Preview page opens.
- If you want to preview your data, select Generate Preview.
- Verify the data.
For data placement, select the target database and table where you want your data placed and indicate how often the import should run.
Select Next. Under Storage, you will create a new or select an existing database and create a new or select an existing table for where you want to place the imported data.
Select a Database > Select an existing or Create New Database.
Optionally, type a database name.
Select a Table> Select an existing or Create New Table.
Optionally, type a table name.
Choose the method for importing the data.
- Append (default)-Data import results are appended to the table. If the table does not exist, it will be created.
- Always Replace-Replaces the entire content of an existing table with the result output of the query. If the table does not exist, a new table is created.
- Replace on New Data-Only replace the entire content of an existing table with the result output when there is new data.
Select the Timestamp-based Partition Key column. If you want to set a different partition key seed than the default key, you can specify the long or timestamp column as the partitioning time. As a default time column, it uses upload_time with the add_time filter.
Select the Timezone for your data storage.
Under Schedule, you can choose when and how often you want to run this query.
- Select Off.
- Select Scheduling Timezone.
- Select Create & Run Now.
- Select On.
- Select the Schedule. The UI provides these four options: @hourly, @daily and @monthly or custom cron.
- You can also select Delay Transfer and add a delay of execution time.
- Select Scheduling Timezone.
- Select Create & Run Now.
After your transfer has run, you can see the results of your transfer in Data Workbench > Databases.
The attributes column contains Salesforce API metadata, such as the API request URI and target object; it is not a field defined on your Salesforce object. Bulk API 2.0 CSV results do not contain this metadata, so eligible Bulk API 2.0 imports exclude the column from the import schema. If your table already has an attributes column, it is NULL for newly imported Bulk API 2.0 rows. Forced REST imports and automatic REST fallbacks keep their existing metadata behavior.