Setting Up the Salesforce Connector
Note: All new Salesforce Commerce projects should use the
Before you begin
Complete the following steps to ensure your setup goes smoothly:
- Complete our Getting Started guide
- Ensure you have Administrator-level access to your Salesforce Commerce site
- Brush up on your knowledge about the Salesforce API, OCAPI. Learning the underlying API is an important prerequisite to setting up your Connector. To review, access the Salesforce documentation.
Making your API accessible
You’ll need to setup your backend API to ensure that all your endpoints are accessible.
The OCAPI client allows your Connector to communicate with Salesforce Commerce, supporting up to version 17.8. Here’s how to setup the OCAPI client:
Create a new OCAPI client ID, which is described in the Salesforce documentation. Be sure to record the client ID that gets created, as you will need it to configure OCAPI settings and the connector.
Update your OCAPI settings in the OCAPI configuration file. (OCAPI settings control which resources are accessible to an authorized user.) To do this, add a client to your OCAPI settings. This client should have access to the resources listed in this file. Here’s an example of a settings file with the resources required for our Commerce Integrations.
Important: When you set up your OCAPI client, never embed any secret values related to it (like its password) in the bundle.
Installing the cartridge (for tag-loaded Salesforce B2C Commerce projects)
Important: Installing the cartridge is only required for tag-loaded Salesforce projects. Server-side rendered projects can skip this step.
Our cartridge is a simple tool that installs the Mobify tag and service worker for tag-loaded projects using a Salesforce Commerce backend.
Download the cartridge from the LINK Marketplace. (This will require you to login with your Salesforce B2C Commerce account.) Once your download is complete, follow the instructions included with the download to configure the Mobify Tag and service worker for your Salesforce backend.
Configuring your Salesforce connector instance
When your project gets generated, you get a starting point Connector, which you will be replacing.
To configure and instantiate your instance of the
- Go to
packages/connector/index.jsand import the
- Extend the connector class and make any customizations you’d like.
- Modify the
getConnectormethod to return a new instance of your extended connector.
Common challenges working with Salesforce connector
In the spirit of acknowledging the challenging aspects up front, the most challenging parts of building Mobify Platform projects with a Salesforce backend include cases when:
- Something you want to access is not available in the Shop API
- The Shop API behavior diverges from the storefront behavior
- Your project requires using session bridging to sync OCAPI and storefront sessions
For more information check out our Salesforce Commerce Concepts series, which is designed to help you tackle the most challenging topics you may encounter while working on a Mobify/Salesforce project.