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

# Connect your AI agent to Salesforce cases

> Let your AI agent respond to Salesforce cases, or escalate conversations by creating a case for your team

The Chatbase Salesforce integration connects your AI agent to your Salesforce org, so it can answer cases by email, draft replies for your support agents, and open a case when a chat conversation needs a person. One Salesforce connection powers all of these, plus the [Salesforce Live Chat Action](https://chatbase.co/docs/user-guides/chatbot/actions/salesforce-actions.md#2-live-chat). It's for teams that already work cases in Salesforce and want the AI agent to take routine questions off their queue.

> [card] What you can do:
>
> Have the AI agent answer Salesforce cases on its own, draft replies for a human to review, or open a case the moment a chat conversation needs a person.

## Available capabilities

You connect Salesforce once per AI agent. The same connection is used whether you connect from **Channels** or **Integrations**, so you don't need to connect twice.

| Capability | What it does | Where you set it up |
| - | - | - |
| [AI case responses](#ai-case-responses-in-salesforce) | The AI agent replies by email to cases owned by the Salesforce user you pick | **Channels > Salesforce** |
| [Generate Draft Response](#generate-draft-response) | Your support agents click a button on a case to get an AI-written draft they can edit before sending | The case page layout in Salesforce |
| [Human escalation via case creation](#human-escalation-via-case-creation) | The AI agent opens a Salesforce case when a chat conversation on another channel needs a person | An [Escalations](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md) Action |
| [Live chat](https://chatbase.co/docs/user-guides/chatbot/actions/salesforce-actions.md#2-live-chat) | The AI agent connects the customer to a human agent in Salesforce in real time | A Salesforce Live chat Action, plus extra Salesforce org configuration |

## Before you start

* A Chatbase account with an AI agent, on the **Basic** plan or higher. If you haven't built an AI agent yet, [create a Chatbase account](https://www.chatbase.co/auth/signup) and follow [Your first AI agent](https://chatbase.co/docs/user-guides/quick-start/your-first-agent.md).
* A Salesforce account you can authorize the integration with. Chatbase signs in through `login.salesforce.com`.
* For case replies and draft responses, permission to install the Chatbase package in your Salesforce org.

Each AI agent connects to one Salesforce org.

## AI case responses in Salesforce

### How to connect Salesforce

**1. Open your Chatbase AI agent**

Head to your [dashboard](https://www.chatbase.co/dashboard/) and click the AI agent you wish to integrate with Salesforce.

**2. Find the Salesforce integration**

Click the **Channels** tab from the sidebar, find the **Salesforce** integration, and click **Connect**.

**3. Authorize the integration**

A new tab will open, asking you to log in to your Salesforce account to authorize the integration.

**4. Install the Chatbase package**

Click **Manage** on the Salesforce integration card and open the **Configs** tab. If the Chatbase package isn't installed in your org yet, you'll see **Salesforce Package Required**. Click **Install Package**, or open the [package install link](https://login.salesforce.com/packaging/installPackage.apexp?p0=04tfn000002MqQD), and install it in Salesforce. The package lets Salesforce tell Chatbase when a case needs a reply.

**5. Configure the integration**

On the **Configs** tab you can then:

* Under **Assign a Salesforce user**, select the Salesforce user that the AI agent will reply as.
* Choose to either sync the AI agent's Salesforce instructions with the global instructions, or write a different instructions prompt. This is useful if you want the AI agent to handle Salesforce cases differently, for example to answer in a more formal tone or to point refund requests to your refund policy.

Then click **Save**.

**6. Verify the reply email address**

Replies are sent from the selected user's email address as a Salesforce **Org-Wide Email Address**. If that address isn't verified in Salesforce yet, Chatbase creates it and shows **Email Verification Required**. Verify the address in Salesforce before you expect replies to go out.

### Which cases get an AI reply

The AI agent replies only to cases owned by the user you picked under **Assign a Salesforce user**. Route cases to that user with your own Salesforce assignment rules, or assign them by hand. Cases owned by anyone else, including a queue, are left alone.

* **Only incoming customer emails get a reply.** When a customer email arrives on a case owned by that user, the AI agent writes a reply and sends it by email, logged on the case.
* **Replies take 30 seconds to 2 minutes.** The delay is on purpose, so don't expect an instant answer when you test.
* **To stop AI replies on a case,** assign the case to a different owner. There's no tag or setting that opts a single case out.
* **Case replies don't change the case.** The AI agent doesn't tag the case, change its status, or add a link to the Chatbase conversation. You can read each exchange in Chatbase **Activity > Conversations**, where it appears as a Salesforce conversation.

### When the AI agent can't reply

In case-reply mode the AI agent always replies if it can. It has no step to escalate or hand the case back. When it can't send a reply, for example because the reply came back empty, the case has no customer email, the case is owned by a queue instead of a user, or sending failed, Chatbase posts a **public** comment on the case telling the customer their issue is important and that the team will be in touch shortly.

Nothing else changes: the owner and status stay as they were. Have your team watch for these comments, because a person needs to pick the case up.

### Generate Draft Response

Don't want the AI agent to respond directly? Add the **Generate Draft Response** button so your support agents can review and edit an AI-generated reply before they send it.

There's no toggle for this in Chatbase. Draft responses turn on when you open **Channels > Salesforce > Configs** with the Chatbase package installed, and they don't need a Salesforce user assigned. You only need to add the button to your case page layout:

**1. Open the page editor**

Navigate to any of your cases, click the gear icon at the top right, then select **Edit Page**.

![Opening the Salesforce page editor from a case](https://mintcdn.com/chatbase/vmwTr3IRMjk1rVuy/user-guides/integrations/images/salesforce/salesforce-3.png?fit=max\&auto=format\&n=vmwTr3IRMjk1rVuy\&q=85\&s=29ce842caa3932a49e526ecba8c5cb92)

**2. Add the action to the layout**

Select the section where you want the button to appear, for example the Highlights Panel. Click **Add Action**, search for **Chatbase AI Draft Response**, and add it to the layout.

![Adding the Chatbase AI Draft Response action to the layout](https://mintcdn.com/chatbase/vmwTr3IRMjk1rVuy/user-guides/integrations/images/salesforce/salesforce-4.png?fit=max\&auto=format\&n=vmwTr3IRMjk1rVuy\&q=85\&s=75908952063e5346d1f027a4c4b0e107)

The **Generate Draft Response** button is then available across all cases, so your support agents can generate a draft whenever they need one. The draft isn't posted to the case: your agent edits it and sends it themselves.

***

## Human escalation via case creation

**1. Connect Salesforce**

Choose **Integrations**, then connect your Salesforce account to authorize access. If you already connected Salesforce from **Channels**, it's the same connection and you can skip this step.

**2. Create the Escalations Action**

Configure your Escalations Action to route tickets to Salesforce. Follow the [Escalations Action guide](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md) to set it up.

> [!TIP]
>
> Test the integration by asking your AI agent to speak to a human, and confirm a case appears in Salesforce with the conversation summary attached.

### What the escalation case contains

The case fields are fixed. You can't add or map other fields.

| Case field | Value |
| - | - |
| **Subject** | A short subject the AI agent writes from the customer's issue. The customer isn't asked for it. |
| **Description** | An AI-written summary of the conversation, in the customer's language. |
| **Case Origin** | `Web` |
| **Web Email** | The customer's email address |
| **Web Name** | The customer's name |

Chatbase also adds a **private** case comment with a link to the full conversation in Chatbase. It doesn't set the status, priority, contact, or owner, so your Salesforce defaults and assignment rules apply. The AI agent tells the customer the case number once the case is created.

Your team's replies on the case don't come back into the chat. They reach the customer however your Salesforce org sends them, normally by email.

The Escalations Action can't be used on Slack, WhatsApp, Messenger, Instagram, or Zendesk Messaging when Salesforce is the ticket platform. Creating a case uses no extra message credits beyond the AI agent's normal reply.

### Example

A customer named Maya writes in the Chat Bubble: "My order arrived damaged and I want a refund. Can someone help?" The AI agent asks for her name and email, then creates the case:

* **Subject:** Refund request for a damaged order
* **Description:** The customer received a damaged order and is asking for a refund. She would like someone from the team to follow up.
* **Case Origin:** Web
* **Web Email:** [maya@example.com](mailto:maya@example.com)
* **Web Name:** Maya Chen
* **Private comment:** conversation link in Chatbase, followed by the link

The AI agent replies with the case number, and your team follows up with Maya by email from Salesforce.

## Disconnecting Salesforce

To disconnect, click **Disconnect** on the Salesforce card. Chatbase lists the Escalations Actions that use Salesforce and asks you to confirm, because disconnecting deletes them. Disconnecting also:

* revokes Chatbase's access to your org
* deletes the Chatbase configuration record in Salesforce
* deletes the Org-Wide Email Address Chatbase created for the AI agent

It doesn't uninstall the Chatbase package. To remove the package, uninstall it in Salesforce.

## Troubleshooting

> [accordion] The AI agent doesn't reply to a case
>
> Check that the case is owned by the user selected under **Assign a Salesforce user**, not by a queue or another user, and that the Chatbase package is installed. Only incoming customer emails trigger a reply, and replies take 30 seconds to 2 minutes. Also check that the reply address is verified as an **Org-Wide Email Address** in Salesforce.

> [accordion] The case got a comment saying the team will be in touch
>
> The AI agent couldn't send a reply, for example because the case has no customer email or sending failed. Nothing about the case was changed, so someone on your team needs to pick it up.

> [accordion] Generate Draft Response says the agent has already replied
>
> The last message on the case is already from your side. Wait for the customer to respond, then generate a new draft.

> [accordion] Escalation cases stopped appearing
>
> If Salesforce access was revoked, case creation fails, but the Salesforce card still shows **Connected** and nobody is notified. Open the conversation in **Activity > Conversations** and check the Action's **Result** for the error. Disconnect and connect Salesforce again to fix it, then recreate your Escalations Action, because disconnecting deletes it.

> [accordion] The Salesforce card shows Upgrade to enable
>
> Salesforce needs the **Basic** plan or higher. Upgrade your plan to connect it.

## Frequently asked questions

> [accordion] Do I need separate Salesforce connections for case replies and escalation?
>
> No. Case replies, draft responses, escalation cases, and live chat all use the same connection, whether you connect from **Channels** or **Integrations**.

> [accordion] Can the AI agent escalate a case it's replying to?
>
> No. In case-reply mode the AI agent doesn't reassign the case or change its status. If it can't reply, it posts a public comment saying the team will be in touch and leaves the case as it is. To take a case away from the AI agent, assign it to someone else.

> [accordion] What does an escalation case contain?
>
> A subject the AI agent writes, a summary of the conversation in the **Description**, **Case Origin** set to `Web`, the customer's email and name in **Web Email** and **Web Name**, and a private comment with a link to the conversation in Chatbase. See [What the escalation case contains](#what-the-escalation-case-contains).

> [accordion] Do my team's Salesforce replies show up in the chat?
>
> No. Replies on an escalation case reach the customer however your org sends them, normally by email. For a real-time conversation in the chat, use the [Salesforce Live chat Action](https://chatbase.co/docs/user-guides/chatbot/actions/salesforce-actions.md#2-live-chat).

> [accordion] Does creating a case use message credits?
>
> No extra credits. The reply in which the AI agent creates the case costs the same as any other reply from your AI agent's [model](https://chatbase.co/docs/user-guides/chatbot/models-comparison.md).

## Next steps

> [card] [Escalations Action](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md)
>
> Configure when your AI agent escalates and which details it collects first.

> [card] [Salesforce Actions](https://chatbase.co/docs/user-guides/chatbot/actions/salesforce-actions.md)
>
> Create cases and connect customers to live agents in Salesforce from the chat.


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