Skip to main content
The Salesforce connector supports:
  • CRM
  • Account Engagement (formerly Pardot)

What’s supported

Supported actions

This connector has two modules, with CRM as the default. The CRM module supports: The Account Engagement module supports:

Supported CRM objects

ObjectReadWriteSubscribe
Account
Campaign
Case
Contact
Event
Lead
Opportunity
Product
Task
User
All other standard objects🟡
(See the full list*)
All custom objects
* Only some standard objects are available for subscribe action. Check here for the full list of supported objects. For each of these CRM objects, the connector supports:
  • Standard fields
  • Custom fields

Supported Account Engagement objects

The Salesforce connector supports the following Account Engagement module objects:

Example integration

Example manifest files can be found in our samples repository on GitHub:

Before you get started

Salesforce orgs needed

You will need two separate Salesforce orgs to complete this process:
  1. Dev Hub Org: A Salesforce org with Dev Hub enabled. You will create the External Client App inside this org.
  2. Namespace Org: A Developer Edition Salesforce org that is only used to register a namespace. You will link this namespace to the Dev Hub Org.

1. Enable Dev Hub

First you need to choose the Salesforce org to make into your “Dev Hub Org”. If you intend to become a Salesforce partner and distribute via AppExchange later: If you don’t intend to become a Salesforce partner: Once you have chosen the Salesforce org you will use as your Dev Hub org, you can enable Dev Hub by following these steps:
  1. Log in to your Salesforce org.
  2. From Setup, enter Dev Hub in the Quick Find box and select Dev Hub.
  3. Select Enable Dev Hub.
  4. Select Enable Unlocked Packages and Second-Generation Managed Packages.
Enable Dev Hub

2. Register a namespace

Please note that namespaces cannot be created in the Dev Hub Org you just enabled in the step above. You must use a separate Salesforce Developer Edition org (we will call this org the “Namespace Org”).
  1. Sign up for a free Developer Edition org.
  2. Navigate to the gear icon in the top right corner and select Setup. Alt text
  3. In the quick search box at the top, type in Package Manager in the Quick Find box and select Package Manager. In Namespace Settings, click Edit.
  4. Enter a namespace and select Check Availability. We recommend picking a namespace that is your product name or a shortened version of your product name.
  5. When prompted to select a package to associate with this namespace, select None, then click Review.
  6. Review your selections and click Save.
Create Namespace
  • Log in to the Dev Hub Org from Step 1.
  • Open App Launcher (9 dots at the top left), and search for Namespace Registries.
  • Click Link Namespace on the top right.
  • When prompted to authenticate, log into the Namespace Org from Step 2. If you are having trouble with this step, try again in an incognito window.
  • After linking, select All Namespace Registries filter to view the namespace.
Link namespace View namespaces

4. Create External Client App

In order to connect with your customer’s Salesforce instances, you’ll need to create a Salesforce External Client App by following the steps below:
  1. Log in to your Dev Hub Org that you created above.
  2. Navigate to the gear icon in the top right corner and select Setup. Alt text
  3. Search for External Client App Manager.
  4. Click New External Client App.
New ECA
  • Enter a name for the External Client App. This should match your product name.
  • Specify a contact email; this should be your support email address.
  • Set Distribution State to “Packaged”.
  • Enable OAuth settings.
  • In callback URL put https://api.withampersand.com/callbacks/v1/oauth.
  • Add the following OAuth scopes at the minimum:
    • Perform requests at any time (refresh_token, offline_access)
    • Manage user data via APIs (api)
✅ For more details on which OAuth scopes to include, refer to the OAuth Tokens and Scopes guide.
  • Uncheck the box for Require Proof Key for Code Exchange (PKCE) extension for Supported Authorization Flows
  • Check the box for Enable Authorization Code and Credentials Flow
Create ECA
  1. Go to the Policies tab, expand “OAuth Policies”, and click the edit button. In the “App Authorization” box, make the following modifications:
  • In “Refresh Token Policy”, select “Refresh token is valid until revoked”
  • In “IP Relaxation”, select “Relax IP restrictions”
  1. Go to the Settings tab, expand “OAuth Settings”. Click on “Consumer Key and Secret”.
Use these keys in the next step.

5. Create Provider App in Ampersand

  1. Log in to your Ampersand Dashboard.
  2. Select the project where you want to create a Salesforce integration. Alt text
  3. Select Provider apps.
  4. Select Salesforce from the Provider list.
  5. Enter the previously obtained Consumer Key in the Client ID field and the Consumer Secret in the Client Secret field.
    Alt text

6. Package the External Client App

In order for your External Client App to be able to make API calls to your customers’ Salesforce instances, Salesforce requires that you create a package version, and have your customers install your package in their Salesforce org.
  1. Install the Salesforce CLI using npm or another supported method:
npm install -g @salesforce/cli
  1. Create a Salesforce DX project. From a new directory, generate a project:
sf project generate --name MySalesforcePackage
Replace MySalesforcePackage with a name that fits your integration, such as your product name.
  1. Authenticate with your Dev Hub Org. From the project directory you just created, log in to your Dev Hub Org (the org where you created the External Client App):
sf org login web --set-default-dev-hub --alias DevHubOrg
A browser window will open for you to sign in.
  1. Set the namespace in the project. Edit sfdx-project.json in the project root. Set the namespace value to the namespace you registered and linked to your Dev Hub earlier:
{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    }
  ],
  "namespace": "MY_NAMESPACE",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "59.0"
}
Replace MY_NAMESPACE with your actual namespace prefix.
  1. Create the managed package. Use the command below and replace these flags with actual values that are applicable to you:
  • name: replace with your product name
  • error-notification-username: this must match the email address of one of the users in the Dev Hub Org. For example, you can use your own email here. This is the email address that will receive notifications from Salesforce about errors in the package.
sf package create \
  --name "My Package" \
  --package-type Managed \
  --path force-app \
  --target-dev-hub DevHubOrg \
  --error-notification-username your-notification-email@company.com
  1. Pull External Client App metadata into the project. Run this command to programmatically fetch the settings that you had just configured for your External Client App:
sf project retrieve start --metadata ExternalClientApplication ExtlClntAppOauthSettings --target-org DevHubOrg
This creates (or updates) metadata under:
  • force-app/main/default/extlClntAppOauthSettings/
  • force-app/main/default/externalClientApps/
If you have several External Client Apps and only want to package one, remove the XML files for the apps you do not want in the package.
  1. Build and promote a package version. Create a new package version (this can take several minutes). Replace My Package with the name you supplied in the name flag of the sf package create command above.
sf package version create \
  --package "My Package" \
  --installation-key-bypass \
  --wait 20 \
  --code-coverage
When it finishes, note the Subscriber Package Version ID that is printed. Please note that two IDs will be printed, you want the “Subscriber Package Version ID”, not the “Package Version”.
  1. Promote that version so it can be installed by customers:
sf package version promote --package SUBSCRIBER_PACKAGE_VERSION_ID --no-prompt
Replace SUBSCRIBER_PACKAGE_VERSION_ID with the ID from the previous step.
  1. Get the package install URL. Use the Subscriber Package Version ID to build the install URL for your package.
For production orgs:
https://login.salesforce.com/packaging/installPackage.apexp?p0=SUBSCRIBER_PACKAGE_VERSION_ID
For sandbox orgs:
https://test.salesforce.com/packaging/installPackage.apexp?p0=SUBSCRIBER_PACKAGE_VERSION_ID
  1. Ask your customers to install the package. Instruct your customers to go to the package install URL and click “Install for All Users”. They must complete this step before connecting their Salesforce account using Ampersand’s prebuilt UI components. Otherwise OAuth will fail.
They should see a screen like this after they are successful.

Migrating Connected App to External Client App

Salesforce no longer supports the creation of new Connected Apps. If you had previously created a Connected App to be used for Ampersand integrations, it will continue to work for your existing and new customers as long as their user profile has the Approve Uninstalled Connected Apps or Use Any API Client permissions. See Salesforce customer guide for details. Whenever you would like to, you can follow these steps to migrate a Connected App to an External Client App:
  1. Open Salesforce Setup and search for Manage Connected Apps and select the Connected App that you want to convert. Click Migrate To External Client Application.
Migrate connected app 1
  1. Check both required checkboxes to confirm migration.
Migrate connected app 2
  1. Click Migrate.
Migrate connected app 3
  1. Click OK.
Migrate connected app 4
  1. A confirmation message will appear.
Migrate connected app 5
  1. Open External Client App Manager.
Migrate connected app 6
  1. Select your app, go to the Settings tab and set “Distribution State” to Packaged.
Migrate connected app 7
  1. Go to the Policies tab, expand “OAuth Policies”, and click the edit button. In the “App Authorization” box, make the following modifications:
  • In “Refresh Token Policy”, select “Refresh token is valid until revoked”
  • In “IP Relaxation”, select “Relax IP restrictions”
  1. Enable Dev Hub on your Salesforce org that is hosting the Connected App (which is now an External Client App).
  2. Create a new Developer Edition Salesforce org and register a namespace, then link the namespace to the Dev Hub Org.
  3. Package the External Client App by following these instructions.

Using the connector

To start integrating with Salesforce:

Customer guide

The Salesforce customer guide is a guide that can be shared with your customers to help them be successful in using your integration.