# Salesforce Commerce Cloud Import Integration Commerce Cloud connects the customer journey and drives success from anywhere with customer-centric commerce built for every industry. - Completely connect your digital customer journey. - Personalize engagement with customer-centric commerce. - Unify data, personalize every interaction, and grow revenue across channels with automation, AI, and a single source of truth. - Connect commerce to the customer journey. - Convert more customers and drive loyalty with a seamless customer journey from marketing to sales, commerce, fulfillment, service, and beyond. Build with your choice of clicks- or code-based tools. - Adapt quickly with an agile, scalable, and secure platform. - Innovate at the speed of your customers, scale easily across the globe, and meet any level of demand. Extend your commerce with a partner ecosystem of apps to deliver experiences like augmented reality, marketplaces, and more. ## What can you do with this Integration? - Salesforce Commerce Cloud Import Integration will provide the following abilities: - Authenticate using API Client via OAuth. - Ingest customer information for a specific list - Ingest of Customer resources, for example: - customer information - name, gender, email - Ingest Product resource, for example: - a list of products - product information - Ingest Inventory and Product Inventories resource, for example: - list of inventories - product inventory allocation - product inventory stock level - product inventory ID - Ingest Category and Product Assignments resource, for example: - category information - product belongs to each category - Ingest Store resources, for example: - all stores - store information including id, address, postal code, country, inventory id - Ingest Catalog resources, for example: - catalog info - assigned product counts ## Prerequisites - Basic Knowledge of Treasure Data - Basic knowledge of Treasure Data CLI - Basic knowledge of Salesforce Commerce Cloud - Basic knowledge of Open Commerce Cloud API - Commerce Cloud Account Manager System Access ## Limitations - The application secret should not contain the `%`  character. Due to an internal issue with the SFCC authentication server, any secret the contains the `% character, is not able to authenticate.` - Incremental loading is only supported for Creation Date, not Modified Date - A large volume of data may cause low performance - In preview mode, the connector does not support generating the detailed data preview because of time restrictions on fetching the data preview. - An Inventory List with no product is still inserted as one record, the properties belong to the Product Inventory List and will be null. ## About Incremental Loading Incremental loading is loading only new or updated records from a source into Treasure Data. It is helpful because it runs efficiently compared to full loads, particularly for large data sets. Incremental loading is available for many of the Treasure Data integrations. In some cases, it is a simple checkbox choice; in others, after you select incremental loading, you are provided with other fields that must be specified. ### About Incremental Loading for Integrations Treasure Data Incremental loading has four patterns (3 types of data connector + 1 workflow td_load operator.), and the 3 data connector loading examples are as follows: - Cloud storage service (e.g., AWS S3, GCS, etc.) - Lexicographic order of file name - Query (e.g., MySQL, BigQuery, etc.) - Date time - Variable period (Google Analytics, etc) - Use start_date for loading ### Incremental Loading for Connectors If incremental loading is selected, data for the connector is loaded incrementally. This mode is useful when fetching just the object targets that have changed since the previously scheduled run. For example, in the UI: ![](/assets/snippet-about-incremental-loading-2024-11-18-1.63417e89e255d0e02570d0882a4929cde027422a934af21ba7541c5001c313a7.7499f82f.png) Database integrations, such as MySQL, BigQuery, and SQL Server, require column or field names to load incremental data. ![](/assets/snippet-about-incremental-loading-2024-11-18.398c24903f2c97039ca73ab56fd98e5cd1158120244ca53bf37dce03cf0513bb.7499f82f.png) Learn more about [Database-Based Integrations](/int/about-database-based-integrations). ### Limitations, Supported, Suggestions - For some integrations, if you choose incremental loading, you might need to ensure that the columns have an index to avoid a full table scan. - Only Timestamp, Datetime, and numerical columns are supported as incremental_columns. - The incremental_columns is required for the raw query because it cannot detect the Primary keys for a complex query. ## Create the API Client on Commerce Cloud Account Manager System These steps are necessary to create the credentials that are needed to define the authentication for your integration. 1. Navigate to the Salesforce Cloud Commerce UI and login. For example, [Account Manager UI](https://account.demandware.com/dw/account/Home#/). ![](/assets/image2021-6-29_11-22-1.174409bb434f9aa760e0da14f511c0e2ba80a3f8b7b0b3092cafb831cd3c1bf4.34709991.png) 1. Select **API Client.** ![](/assets/screen-shot-2021-05-18-at-10.47.20.be4fec22b1256686095d473c7740365177027c0ed2e9ffb8b6c407a080314b68.34709991.png) 1. Select **Add API Client.** ![](/assets/screen-shot-2021-05-18-at-10.48.06.8889c5457f7f0dc1e4bafc2ad44bac3bbe46fdd7e7fd1d12800d528888272d6e.34709991.png) 1. Type values for: - **Display Name** - **Password** - **Confirm Password** 1. Select Access Control to enable it. 2. In the Organizations area, select your organization. 3. In the Roles area, select **Add**. 4. Select the appropriate role. For example, **Sandbox API User.** ![](/assets/screen-shot-2021-05-18-at-10.52.00.2f412cde157b2237cb6cd3c2ac84c5f2d268266671525d06102ec07de59d79ef.34709991.png) 5. Select **Add.** 6. After the role is added, select all the sandboxes associated with it. ![](/assets/screen-shot-2021-05-18-at-10.56.20.819b3044b29100a213ff1d6adff5194069c1ec3060f6553b1ad5c4c3522312d4.34709991.png) 1. Select **Add**. 2. Scroll down to Open ID Connect. 3. Add **Default Scopes:** - **mail** - **roles** - **tenantFilter** - **profile** 1. Add **Redirect URI**. For example: [https://admin.us01.dx.commercecloud.salesforce.com/oauth2-redirect.html](https://admin.us01.dx.commercecloud.salesforce.com/oauth2-redirect.html) 1. Scroll totheToken Endpoint Auth Methodsection. 2. Select **client_secret_basic.** 3. Select **JWT** for Access Token Format. ![](/assets/screen-shot-2021-05-18-at-10.59.42.caff70407f1f595dd5532a653e7edfde4981c4ce8eead310e35bc53cd184cd1e.34709991.png) 1. Select **Save**. 2. You are taken back to the API Client screen. ![](/assets/screen-shot-2021-05-18-at-11.00.12.cb9834691790cd0d23f476174914356bc415e19090c477b458ea6855ea7b1f08.34709991.png) 1. Write down or save in a secure location the **API Client ID** and **Password**. These are used as Authentication credentials to integrate with your SFCC instance. ## Enable the API Client to Access the Data API These steps enable your API Client to be used with the Data APIand Salesforce B2C Commerce Cloud connector. 1. Open Business Manager. For example: [https://{YOUR_INSTANCE_URL}.commercecloud.salesforce.com/on/demandware.store/Sites-Site/default/ViewApplication-DisplayWelcomePage](https://treasure-data.atlassian.net/wiki/spaces/EN/pages/1957200062/Salesforce+Commerce+Cloud+Sandbox+access) 1. Select **Administration**. 2. Select **Open Commerce API Settings**. ![](/assets/screen-shot-2021-05-18-at-11.14.56.22f4966f9acc62700502855a8614f8279229742bef4096f8e623c4ee65c4de85.34709991.png) Select Type as **Data**. ![](/assets/screen-shot-2021-05-18-at-11.17.04.c1b302b94a60b61d7fcf3e0bd611ed1efbbab4856fb53942f53957ac5716e6f3.34709991.png) The configuration for Data API appears. 1. Type or copy the following into the text field: ```json { "_v": "21.6", "clients": [ { "client_id": "your_api_client_id", "resources": [ { "methods": [ "get", "post", "put", "patch", "delete" ], "read_attributes": "(**)", "write_attributes": "(**)", "resource_id": "/**" } ] } ] } ``` 1. For Select Context choose **Global (organization-wide)**. ![](/assets/screen-shot-2021-05-18-at-11.20.52.2e465d6b6b5f91ad7b9806e8a67739889dcb08227a3671a7b60e69f05a562b61.34709991.png) 1. Select **Save**. Wait for at least 3 minutes. Your API Client is ready to be used with Data APIand Salesforce B2C Commerce Cloud connector. ## 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. Open **TD Console**. Navigate to **Integrations Hub** >  **Catalog**. Search for and select **Salesforce B2C Commerce Cloud.** ![](/assets/screen-shot-2021-06-29-at-10.23.14-am.95fe1756c7a15029a255225954eb4c44ee6592a62323634326e49fdff2d19c4c.34709991.png) Choose **Create Authentication.** The following dialog opens: ![](/assets/screen-shot-2021-06-29-at-10.26.36-am.820d595d84b6053b95bc3d3ae74dfce26b90dfcbac6acd3c53293a19ecdbc71d.34709991.png) Type or select the required information: | Parameter | Description | | --- | --- | | API Client ID | Key which you got after create your application on Commerce Cloud's Account Manager Application. | | API Client Password | The password for your API Client when you create on Commerce Cloud's Account Manager Application. | | Base URI | URL for accessing your Business Manager Application. Example value https://xxxx.commercecloud.salesforce.com/ | 1. Type a name for your connection. ![](/assets/screen-shot-2021-06-29-at-10.29.48-am.f501d8dc4735de285c585836bb0c0e4ea5ae593d95ad78cf9e1372834485b588.34709991.png) 1. Select **Continue.** ### Transfer Your Data to Treasure Data After creating the authenticated connection, you are automatically taken to Authentications. 1. Search for the connection you created. ![](/assets/screen-shot-2021-06-29-at-10.37.51-am.483161564aa5c70e0fbfa6860c5b93a1c136046e6e9dc9810a4064637e6d604c.34709991.png) 1. Select **New Source**. 2. Type a name for your **Source** in the Data Transfer field**.** ![](/assets/screen-shot-2021-06-29-at-10.39.30-am.0f71ffe4ddd930c62ee4c3aefae3dc2fa900ff7e4b65ae171e5d04537f8123e3.34709991.png) 1. Select **Next**. 2. The Source Table dialog opens. 3. Edit the following parameters: ![](/assets/d63b3e0c-bb0c-42e1-ac47-d7a453b90ff0.a48efca75fe1acbf0f32b8f313d30bd1969e36f4d439e7af2b47450d7d6ee8ea.34709991.png) | Parameters | Description | Description of Data Types | | --- | --- | --- | | Data Type | The data objects that you want to ingest into Treasure Data: | | | | **Customers From List** | The customer info from a specific customer list | | | **Products** | Product info of Salesforce Commerce Cloud account | | | **Categories and Product Assignments** | Product category info and products belong to each category | | | **Inventory Lists and Product Inventories** | Inventory list and product in each inventory list | | | **Stores** | Store info, location, and inventory belongs to stores | | | **Catalogs** | Product catalog info and count of products for each catalog | | Customer List ID | The customer List ID you want to import customer information from | | | Incremental loading | Select to ingest only **newly created** data since the previous ingestion. | | | Created From | The specific time you would like to ingest the data (`YYYYMMDDHH` format). | | 1. Select **Next**. 2. The Data Settings page can be modified for your needs or you can skip the page. Optionally, edit the following parameters: ![](/assets/screen-shot-2021-06-29-at-10.48.43-am.88b0b629cf1587026b98a4aec100886c2381608b4a7dfce8e00ffc6182df1e50.34709991.png) 1. Select **Next**. ### Data Preview You can see a [preview](/products/customer-data-platform/integration-hub/batch/import/previewing-your-source-data) 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. 1. Select **Next**. The Data Preview page opens. 2. If you want to preview your data, select **Generate Preview**. 3. Verify the data. ### Data Placement For data placement, select the target database and table where you want your data placed and indicate how often the import should run. 1. 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. 2. Select a **Database** > **Select an existing** or **Create New Database**. 3. Optionally, type a database name. 4. Select a **Table**> **Select an existing** or **Create New Table**. 5. Optionally, type a table name. 6. 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. 7. 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. 8. Select the **Timezone** for your data storage. 9. Under **Schedule**, you can choose when and how often you want to run this query. #### Run once 1. Select **Off**. 2. Select **Scheduling Timezone**. 3. Select **Create & Run Now**. #### Repeat Regularly 1. Select **On**. 2. Select the **Schedule**. The UI provides these four options: *@hourly*, *@daily* and *@monthly* or custom *cron*. 3. You can also select **Delay Transfer** and add a delay of execution time. 4. Select **Scheduling Timezone**. 5. Select **Create & Run Now**. After your transfer has run, you can see the results of your transfer in **Data Workbench** > **Databases.** # Available Configuration | **Configuration name** | **Type** | **Available when** | **Required** | **Sample value** | **Description** | | --- | --- | --- | --- | --- | --- | | base_url | STRING | default | yes | [https://xxxx.example.com](https://xxxx.example.com) | SFCC’s instance base url | | catalog_id | STRING | target = categories | no | test | Catalog’s ID | | client_id | STRING | default | yes | abcdef | Application’s ID | | client_secret | STRING | default | yes | abcdef | Application’s Secret | | customer_list_id | STRING | target = customers | yes if target = customers | test | Customer List Id | | incremental | BOOLEAN | target = customers target = products target = catalog | no | true | Ingest incremental or not | | initial_retry_wait | LONG | default | no | 1 | First wait time when retrying (in seconds) | | inventory_list_id | STRING | target = inventory_lists | no | test | Inventory List’s ID | | last_value | STRING | target = customers target = products target = catalog | no | 2021-05-25T02:49:29.000Z | The timestamp to start ingest data | | levels | LONG | target = categories | yes if target = categories | 0 | Level of sub-category to ingest when target = categories | | maximum_retries | LONG | default | no | 5 | Maximum number of retry | | maximum_retry_wait | LONG | default | no | 120 | Max wait time when retrying (in seconds) | | site_id | STRING | target = products target = stores | yes if target = stores | test | The Site ID | | target | ENUM (customers , stores , categories , products , catalogs , inventory_lists ) | default | yes | customers | Target data type to ingest | | product_inventory_records_count | INTEGER | target = inventory_lists | no | 300 | Count for retrieving only a subset of Product Inventory records. Default: 200, Min: 25 | # Sample Configuration ## Customers ``` in:   type: salesforce_commerce_cloud   client_id: xxx   client_secret: yyy   base_url: https://{realm_id}-001.sandbox.us01.dx.commercecloud.salesforce.com/   target: customers   customer_list_id: phu_test   last_value: 2021-05-25T02:49:29.000Z   incremental: true ``` ## Products ``` in:   type: salesforce_commerce_cloud   client_id: xxx   client_secret: yyy   base_url: https://{realm_id}-001.sandbox.us01.dx.commercecloud.salesforce.com/   target: products   site_id: phu_test   incremental: true   last_value: 2021-05-25T02:55:28.000Z ``` ## Stores ``` in:   type: salesforce_commerce_cloud   client_id: xxx   client_secret: yyy   base_url: https://{realm_id}-001.sandbox.us01.dx.commercecloud.salesforce.com/   target: stores   site_id: phu_test2 ``` ## Inventory Lists and Product Assignments ``` in:   type: salesforce_commerce_cloud   client_id: xxx   client_secret: yyy   base_url: https://{realm_id}-001.sandbox.us01.dx.commercecloud.salesforce.com/   target: INVENTORY_LISTS ``` ## Categories ``` in:   type: salesforce_commerce_cloud   client_id: xxx   client_secret: yyy   base_url: https://{realm_id}-001.sandbox.us01.dx.commercecloud.salesforce.com/   target: categories   catalog_id: phu_cat ``` ## Catalogs ``` in:   type: salesforce_commerce_cloud   client_id: xxx   client_secret: yyy   base_url: https://{realm_id}-001.sandbox.us01.dx.commercecloud.salesforce.com/   target: catalogs   incremental: true   last_value: 2021-05-26T02:55:28.000Z ```