> ## 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](https://docs.retellai.com/integrations/salesforce-contact-sync.md) and [agent functions](https://docs.retellai.com/integrations/salesforce-functions.md): 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**.

## 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](https://docs.retellai.com/integrations/salesforce-functions.md) 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.

[How to Connect Salesforce with Retell built-in CRM](https://www.youtube.com/embed/N3Wx9IMniIU)

## Step 1: Create an External Client App

**1. 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.

![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.](https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-new-app.png?fit=max\&auto=format\&n=M9dkUq1iShh05WLW\&q=85\&s=6d5fe07b005ac7997198c05c0900891f)

The External Client App Manager in Setup.

> [!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.

**2. 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 2: Enable OAuth and the client credentials flow

**1. Enable OAuth settings**

Still on the creation screen, expand **API (Enable OAuth Settings)** and turn OAuth on. This reveals the **App Settings** fields below.

**2. 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.

**3. 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`.

**4. 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.

![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.](https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-oauth.png?fit=max\&auto=format\&n=M9dkUq1iShh05WLW\&q=85\&s=50da9df582b0836f64790a548a5f3e87)

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.

**5. 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.

## Step 3: Copy the consumer key and secret

**1. 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.

![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.](https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-consumer-secret.png?fit=max\&auto=format\&n=M9dkUq1iShh05WLW\&q=85\&s=03c81415fefd89bee621b40747de7a10)

The Consumer Key and Secret link on the app's Settings tab.

**2. 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.

## 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.

**1. Open the Policies tab**

On the app's detail page, select the **Policies** tab and click **Edit**.

**2. 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**.

![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.](https://mintcdn.com/retellai/M9dkUq1iShh05WLW/images/integration/salesforce-app-policy.png?fit=max\&auto=format\&n=M9dkUq1iShh05WLW\&q=85\&s=15e21ef64778a992e23837e071a4adcd)

The app's Policies tab with the client credentials flow bound to a Run As user.

> [!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.

**3. 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](https://docs.retellai.com/integrations/salesforce-functions.md) 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.

**4. Save**

Click **Save**.

## Step 5: Connect Salesforce in Retell

**1. 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).

**2. 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.

![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.](https://mintcdn.com/retellai/eQ17pyeTZnmNJIsQ/images/integration/config-salesforce-integration.png?fit=max\&auto=format\&n=eQ17pyeTZnmNJIsQ\&q=85\&s=cf8fda29ba06c52721dca625558028a2)

The Salesforce connection dialog: instance URL plus the External Client App's credentials.

**3. 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.

**4. Verify it worked**

On the **Connected** tab, the Salesforce connection shows as connected. See [Salesforce contact sync](https://docs.retellai.com/integrations/salesforce-contact-sync.md) to import your Contacts and log conversations as Tasks, or start using [agent functions](https://docs.retellai.com/integrations/salesforce-functions.md) right away.

## Troubleshooting

> [accordion] 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] 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] 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] 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] 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.

## FAQ

> [accordion] 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](https://docs.retellai.com/integrations/salesforce-contact-sync.md) 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.

## Next steps

> [card] [Salesforce contact sync](https://docs.retellai.com/integrations/salesforce-contact-sync.md)
>
> Import your Contacts, write analysis results back, and log conversations as Tasks.

> [card] [Salesforce agent functions](https://docs.retellai.com/integrations/salesforce-functions.md)
>
> Look up the caller, read opportunities and cases, create contacts and leads, and run SOQL queries mid-conversation.

> [card] [Integrations overview](https://docs.retellai.com/integrations/overview.md)
>
> See every provider Retell connects to and how integration tools work.

> [card] [CRM integrations](https://docs.retellai.com/integrations/crm-overview.md)
>
> How contact sync, analysis mapping, and activity logging work across CRM providers.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.