> ## Documentation Index
> Fetch the complete documentation index at: https://docs.retellai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Salesforce

> Connect Salesforce to Retell AI with an External Client App: OAuth client credentials, the Run As user setup, and how to verify the connection works.

Connecting Salesforce takes an External Client App with the client credentials flow enabled and a Run As user. One connection covers both [contact sync](/integrations/salesforce-contact-sync) and [agent functions](/integrations/salesforce-functions): your agents work your Contacts, opportunities, and cases live, and Retell keeps the Contact records current. This page covers the Salesforce-side setup and the credentials Retell needs.

<Note>
  Retell authenticates with the **OAuth 2.0 client credentials flow**.
</Note>

## When to use it

Connect Salesforce when Salesforce is your system of record and you want your agents to work from it without anyone copying data between tools. It's the right choice when you want to:

* **Call or text people who already exist in Salesforce.** Contacts sync into Retell automatically, so your agent greets callers by name and knows their account details instead of asking for them.
* **Keep Salesforce current without manual data entry.** Analysis results from each conversation (qualification status, stated preferences, a corrected email address) write back to the Contact record.
* **Give your sales team call history where they already work.** Each call and chat lands on the Contact's activity timeline as a Task, with the summary and duration.
* **Let the agent act on Salesforce directly.** [Integration tools](/integrations/salesforce-functions) identify the caller by number, read their opportunities and cases, create a Contact or Lead when a new caller comes in, run a SOQL query for anything else, and update records the caller corrects.

For example, an insurance agency's outbound agent works renewal lists from Salesforce: it greets each Contact by name, answers policy questions from the Account record, creates a Lead when a referral comes up, and every conversation lands on the timeline as a Task.

## Prerequisites

* A Salesforce edition with API access: Enterprise, Unlimited, Developer, or Performance. Professional needs Salesforce's paid API add-on; Essentials has no API access at all.
* **System Administrator** permissions in Salesforce, or a role that can create External Client Apps.
* A Salesforce user to run the integration as. Use a dedicated integration user rather than a person's account, so the connection doesn't break when someone changes roles or leaves.

Video walkthrough: connecting Salesforce and setting up contact sync end to end.

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/N3Wx9IMniIU" title="How to Connect Salesforce with Retell built-in CRM" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

## Step 1: Create an External Client App

<Steps>
  <Step title="Open the External Client App Manager">
    Log in to Salesforce as an administrator. Click the **gear icon** in the top-right corner, then select **Setup**.

    In the left sidebar under **Platform Tools**, go to **Apps > External Client Apps > External Client App Manager**. Click **New External Client App** in the top-right corner.

    <Frame caption="The External Client App Manager in Setup.">
      <div style={{ aspectRatio: '16 / 9', width: '100%', background: 'rgba(128,128,128,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', borderRadius: '8px', overflow: 'hidden' }}>
        <img src="https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-new-app.png?fit=max&auto=format&n=M9dkUq1iShh05WLW&q=85&s=6d5fe07b005ac7997198c05c0900891f" alt="The Salesforce External Client App Manager page. The left Setup sidebar shows Apps expanded with External Client Apps > External Client App Manager selected, and the New External Client App button is highlighted at the top right of the page." style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }} data-og-width="3448" width="3448" data-og-height="1840" height="1840" data-path="images/integration/salesforce-new-app.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-new-app.png?w=280&fit=max&auto=format&n=M9dkUq1iShh05WLW&q=85&s=a188d2243982da46afa1c8dd3e752eee 280w, https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-new-app.png?w=560&fit=max&auto=format&n=M9dkUq1iShh05WLW&q=85&s=49abf852df3d453e93d4ba41e2a13a50 560w, https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-new-app.png?w=840&fit=max&auto=format&n=M9dkUq1iShh05WLW&q=85&s=6d7df5da8e3b0f5a5e56bc47332ef49f 840w, https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-new-app.png?w=1100&fit=max&auto=format&n=M9dkUq1iShh05WLW&q=85&s=b47a993bfdaf9dcbe66df83d843d6d02 1100w, https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-new-app.png?w=1650&fit=max&auto=format&n=M9dkUq1iShh05WLW&q=85&s=9614dce0204f136bfe69b88795f4d937 1650w, https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-new-app.png?w=2500&fit=max&auto=format&n=M9dkUq1iShh05WLW&q=85&s=517172dd249ac1c11fb5f10e19146ecd 2500w" />
      </div>
    </Frame>

    <Note>
      **External Client Apps** replace the older **Connected Apps** for new integrations. If your org still creates apps under **App Manager > New Connected App**, the field names are the same but the screens are laid out differently, and the client credentials setting lives under **Manage > Edit Policies** instead of the Policies tab.
    </Note>
  </Step>

  <Step title="Fill in the basic information">
    Under **Basic Information**, enter:

    * **External Client App Name** — a descriptive name, for example `Retell AI`.
    * **API Name** — auto-filled from the name; leave it as is.
    * **Contact Email** — your admin email address.

    Leave **Distribution State** set to `Local`. The app only needs to work inside your own org.
  </Step>
</Steps>

## Step 2: Enable OAuth and the client credentials flow

<Steps>
  <Step title="Enable OAuth settings">
    Still on the creation screen, expand **API (Enable OAuth Settings)** and turn OAuth on. This reveals the **App Settings** fields below.
  </Step>

  <Step title="Set a callback URL">
    Enter this **Callback URL**:

    ```
    https://api.retellai.com/oauth-callback/salesforce
    ```

    The client credentials flow never redirects a browser, so this value is never used. Salesforce requires the field regardless, and any valid HTTPS URL is accepted.
  </Step>

  <Step title="Select OAuth scopes">
    Move these from **Available OAuth Scopes** to **Selected OAuth Scopes**:

    * **Manage user data via APIs (api)** — the only scope Retell requires. It covers every REST and SOQL call Retell makes.
    * **Perform requests at any time (refresh\_token, offline\_access)** — optional. The client credentials flow doesn't issue refresh tokens, so this changes nothing for Retell, but it's harmless if your org adds it by default.

    Don't select **Full access (full)** alone. The client credentials flow filters `full` out of the tokens it issues, and since Salesforce's Winter '26 release, a token request whose selected scopes are all unsupported is rejected with `invalid_grant: no valid scopes defined`.
  </Step>

  <Step title="Enable the client credentials flow">
    Under **Flow Enablement**, check **Enable Client Credentials Flow**. This is the setting that lets Retell authenticate without an interactive login. Leave the other flows unchecked.

    <Frame caption="The Flow Enablement section on the creation screen. This capture predates the scope guidance above: select Manage user data via APIs (api), not Full access.">
      <div style={{ aspectRatio: '16 / 9', width: '100%', background: 'rgba(128,128,128,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', borderRadius: '8px', overflow: 'hidden' }}>
        <img src="https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-oauth.png?fit=max&auto=format&n=M9dkUq1iShh05WLW&q=85&s=50da9df582b0836f64790a548a5f3e87" alt="Salesforce External Client App creation form. App Settings shows a Callback URL and, in Selected OAuth Scopes, Full access (full), which is an outdated choice: select Manage user data via APIs (api) instead, per the step above. Below, the Flow Enablement section has the Enable Client Credentials Flow checkbox checked, with Authorization Code, Device, JWT Bearer, and Token Exchange flows unchecked." style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }} width="3450" height="1832" data-path="images/integration/salesforce-oauth.png" />
      </div>
    </Frame>
  </Step>

  <Step title="Create the app">
    Click **Create**.

    <Warning>
      A new External Client App can take up to 30 minutes to become available (Salesforce cites 2 to 10 minutes for most apps). If connecting in Retell fails right after you create the app, wait and try again before assuming the credentials are wrong.
    </Warning>
  </Step>
</Steps>

## Step 3: Copy the consumer key and secret

<Steps>
  <Step title="Open the app's Settings tab">
    From the External Client App Manager, open the app you just created and select the **Settings** tab. Expand **OAuth Settings**, then under **App Settings** click **Consumer Key and Secret**.

    Salesforce may ask you to verify your identity with a code sent to your email before showing the credentials.

    <Frame caption="The Consumer Key and Secret link on the app's Settings tab.">
      <div style={{ aspectRatio: '16 / 9', width: '100%', background: 'rgba(128,128,128,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', borderRadius: '8px', overflow: 'hidden' }}>
        <img src="https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-consumer-secret.png?fit=max&auto=format&n=M9dkUq1iShh05WLW&q=85&s=03c81415fefd89bee621b40747de7a10" alt="The Settings tab of a Salesforce External Client App named Retell AI. Basic Information shows the app name, API name Retell_AI, contact email, and Distribution State Local. Below, the OAuth Settings section contains an App Settings box with the Consumer Key and Secret link highlighted, above the Callback URL field." style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }} width="3456" height="1824" data-path="images/integration/salesforce-consumer-secret.png" />
      </div>
    </Frame>
  </Step>

  <Step title="Store both values">
    Copy and securely store:

    * **Consumer Key** — Retell's **Client ID**.
    * **Consumer Secret** — Retell's **Client Secret**.

    <Warning>
      Treat the consumer secret like a password. Don't share it in plaintext or commit it to source control. Retell encrypts it at rest and never returns it once saved.
    </Warning>
  </Step>
</Steps>

## Step 4: Set the Run As user

The client credentials flow has no logged-in user, so Salesforce needs to know whose permissions to apply. Every read and write Retell makes runs as this user.

<Steps>
  <Step title="Open the Policies tab">
    On the app's detail page, select the **Policies** tab and click **Edit**.
  </Step>

  <Step title="Enable the flow and pick the user">
    Expand **OAuth Policies** and find **OAuth Flows and External Client App Enhancements**. Check **Enable Client Credentials Flow**, then enter your integration user's username in **Run As (Username)**.

    <Tip>
      Enter the user's **Username**, not their email address. They're separate fields, and because a username has to be unique across every Salesforce org, they often differ. A sandbox, for example, appends the sandbox name, so `you@acme.com` becomes `you@acme.com.dev`. Copy the exact value from the **Username** column under **Setup > Users > Users**.
    </Tip>

    <Frame caption="The app's Policies tab with the client credentials flow bound to a Run As user.">
      <div style={{ aspectRatio: '16 / 9', width: '100%', background: 'rgba(128,128,128,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', borderRadius: '8px', overflow: 'hidden' }}>
        <img src="https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-app-policy.png?fit=max&auto=format&n=M9dkUq1iShh05WLW&q=85&s=15e21ef64778a992e23837e071a4adcd" alt="The Policies tab of a Salesforce External Client App. App Policies shows Start Page set to None. Under OAuth Policies, Plugin Policies sets Permitted Users to All users can self-authorize. The highlighted OAuth Flows and External Client App Enhancements section has Enable Client Credentials Flow checked and a Run As (Username) field filled in with an integration user's Salesforce username." style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }} width="3448" height="1816" data-path="images/integration/salesforce-app-policy.png" />
      </div>
    </Frame>

    <Note>
      You check **Enable Client Credentials Flow** in two places, and both are required. The checkbox at creation time turns the flow on for the app; this one binds it to a running user. Without a Run As user, token requests fail even though the flow looks enabled.
    </Note>
  </Step>

  <Step title="Confirm the user's permissions">
    Every read and write Retell makes is checked against the Run As user's profile and permission sets, so grant only what you'll use:

    * **API Enabled** on the user's profile or a permission set. Without it, every API call is refused.
    * **Read** on Contact and on every field you plan to import.
    * **Edit** on Contact and on every field you plan to write back, if you enable outbound sync.
    * **Create** on Task, if you enable activity logging or the **Create Task** tool.
    * For the [integration tools](/integrations/salesforce-functions) you plan to use: **Read** on Lead, Account, Opportunity, Case, and User; **Edit** on Contact, Lead, and Account for the update tools; **Create** on Contact and Lead for the create tools; **Read** on every object a **Query Records** SOQL query touches; and the same permissions on any custom object you configure a tool for. Creating a Note needs **Edit** on the record it attaches to, since Notes take their access from the parent record.

    A missing object or field permission doesn't break the connection. It makes that field silently fail to sync, or that one tool fail, which is harder to spot, so check the profile or permission set before you rely on a mapping.
  </Step>

  <Step title="Save">
    Click **Save**.
  </Step>
</Steps>

## Step 5: Connect Salesforce in Retell

<Steps>
  <Step title="Add the connection">
    In the Retell Dashboard, open **Integrations**, select the **Available** tab, find **Salesforce**, and click **Connect** (**Add Account** if a connection already exists).
  </Step>

  <Step title="Enter your credentials">
    Fill in the fields:

    | Field               | Value                                                             |
    | ------------------- | ----------------------------------------------------------------- |
    | **Connection name** | Alias for this connection; prefilled with `Salesforce - OAuth`.   |
    | **Instance URL**    | Your My Domain URL, for example `https://acme.my.salesforce.com`. |
    | **Client ID**       | The **Consumer Key** from Step 3.                                 |
    | **Client Secret**   | The **Consumer Secret** from Step 3.                              |

    <Warning>
      The instance URL has to be your My Domain URL in the form `https://<domain>.my.salesforce.com`, lowercase and with no path; a trailing slash is trimmed for you. A Lightning URL like `https://acme.lightning.force.com` is rejected with `Instance URL must be in the format https://<domain>.my.salesforce.com`. Sandbox domains such as `https://acme--dev.sandbox.my.salesforce.com` are accepted.
    </Warning>

    <Frame caption="The Salesforce connection dialog: instance URL plus the External Client App's credentials.">
      <div style={{ aspectRatio: '16 / 9', width: '100%', background: 'rgba(128,128,128,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', borderRadius: '8px', overflow: 'hidden' }}>
        <img src="https://mintcdn.com/retellai/eQ17pyeTZnmNJIsQ/images/integration/config-salesforce-integration.png?fit=max&auto=format&n=eQ17pyeTZnmNJIsQ&q=85&s=cf8fda29ba06c52721dca625558028a2" alt="Retell's Salesforce connection dialog on its Connect tab, with a Functions tab beside it. It has a Connection name field prefilled with Salesforce - OAuth, an Instance URL field with the placeholder https://acme.my.salesforce.com, and Client ID and Client Secret fields with placeholders for the connected app's credentials, above a Need help finding your credentials link and Cancel and Add Account buttons." style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }} width="1204" height="1004" data-path="images/integration/config-salesforce-integration.png" />
      </div>
    </Frame>
  </Step>

  <Step title="Connect and confirm">
    Click **Connect** (**Add Account** if a connection already exists). Retell creates the connection and immediately tests it against the Salesforce API.

    On success the dialog reports the connection as verified and offers **Set up contact sync**. On failure it shows Salesforce's own error and re-enables the fields so you can correct them.
  </Step>

  <Step title="Verify it worked">
    On the **Connected** tab, the Salesforce connection shows as connected. See [Salesforce contact sync](/integrations/salesforce-contact-sync) to import your Contacts and log conversations as Tasks, or start using [agent functions](/integrations/salesforce-functions) right away.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connecting fails right after I created the app">
    Give a newly created External Client App up to 30 minutes to become available, then retry. If it still fails, confirm **Enable Client Credentials Flow** is checked on both the app's creation settings and its Policies tab, and that **Run As (Username)** is set.
  </Accordion>

  <Accordion title="Retell rejects my instance URL">
    Find the correct value in Salesforce under **Setup > Company Settings > My Domain**, then check it against the format above. Lightning URLs (`.lightning.force.com`) and bare `.salesforce.com` URLs are rejected.
  </Accordion>

  <Accordion title="The connection shows an error after working for a while">
    Retell flags a connection as errored when Salesforce rejects the credentials: an HTTP 401, or Salesforce's `INVALID_SESSION_ID`. The usual causes are a rotated consumer secret, a deactivated Run As user, or the app being deleted or disabled in Salesforce. Reconnect with current credentials.
  </Accordion>

  <Accordion title="Requests are blocked by IP restrictions">
    If your org enforces login IP ranges on the Run As user's profile, or the app's OAuth policies enforce IP restrictions, Salesforce refuses Retell's calls because they come from cloud IPs. On the app's **Policies** tab, set **IP Relaxation** to **Relax IP restrictions**, or exempt the integration user's profile from login IP ranges.
  </Accordion>

  <Accordion title="I need to rotate the consumer secret">
    On the **Connected** tab, open the connection's settings. The saved secret shows masked; paste the new one over it (re-enter the Client ID too if it changed) and click **Reconnect**. Retell verifies the new credentials before saving, and your field mappings and synced contacts are untouched.
  </Accordion>
</AccordionGroup>

## FAQ

<AccordionGroup>
  <Accordion title="Can I connect more than one Salesforce org?">
    You can add multiple connections, but only one CRM connection in your workspace can drive [contact sync](/integrations/salesforce-contact-sync) at a time, across every provider. The **Contact sync** toggle in a connection's settings decides which one; turning it on for one connection takes sync over from the previous one.
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Salesforce contact sync" icon="rotate" href="/integrations/salesforce-contact-sync">
    Import your Contacts, write analysis results back, and log conversations as Tasks.
  </Card>

  <Card title="Salesforce agent functions" icon="wrench" href="/integrations/salesforce-functions">
    Look up the caller, read opportunities and cases, create contacts and leads, and run SOQL queries mid-conversation.
  </Card>

  <Card title="Integrations overview" icon="plug" href="/integrations/overview">
    See every provider Retell connects to and how integration tools work.
  </Card>

  <Card title="CRM integrations" icon="database" href="/integrations/crm-overview">
    How contact sync, analysis mapping, and activity logging work across CRM providers.
  </Card>
</CardGroup>
