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

# Salesforce

> Answer Salesforce cases by email or as drafts, escalate cases to your team, and hand website chats to Salesforce live chat

Connect a Salesforce org and your agent works the cases assigned to one
Salesforce user. It can email the customer from the case, or prepare a draft
that a teammate reviews and sends. The same connection lets the agent escalate a
case it should not answer, open a case from a chat, and hand a website
conversation to a person in Salesforce.

The connection is shared with [Salesforce contact
syncing](https://cntillion.com/docs/customer-data/crm-integrations.md), so disconnecting one disconnects the
other.

Read [Connecting a channel](https://cntillion.com/docs/channels/overview.md) first.

## What you need

* The Standard plan or above.
* The Owner or Member role in the Centillion workspace.
* A Salesforce user to authorize the connection. It needs API access, read
  access to Case, CaseComment, EmailMessage and User, create access to Case,
  edit access to Case and its IsEscalated field, and permission to manage
  organization-wide email addresses and Remote Site Settings.
* An active Salesforce user with an email address for the agent to reply as.
* For [live chat](#live-chat), Salesforce Enhanced Chat and Omni-Channel. A
  Developer org may not include Enhanced Chat.

## Connect it

**1. Authorize your org**

Open **Channels** in your agent's sidebar. On the **Salesforce** card,
choose **Setup**, then **Connect**. Sign in to Salesforce in the new window
and authorize the org your support team uses. If nothing opens, allow
pop-ups for Centillion and try again.

**2. Open Manage**

Once the card shows **Connected**, choose **Manage**. The Salesforce screen
has three tabs: **Overview**, **Configs** and **Actions**.

**3. Choose the model and instructions**

In **Overview**, pick the **Model** for case replies. Leave **Sync with
global instructions** on to use the agent's global instructions, or turn it
off and write instructions that apply only to Salesforce.

## Install the package

The agent works inside Salesforce through a package you install in your org.
Until it is installed, **Configs** shows **Install Package** and you cannot pick
a user.

**1. Run the installer**

In **Configs**, choose **Install Package**, then **Open Salesforce
installer**. Choose **Install for Admins Only** and install. To try it in a
sandbox first, choose **Install in a sandbox** instead.

**2. Assign the permission sets**

In Salesforce, assign **Centillion integration administrator** to the user
who connected Centillion. Assign **Centillion case responses** to every
teammate who will generate drafts.

**3. Check the installation**

Back in **Configs**, choose **Check installation**. The **Install Package**
notice goes away once Centillion finds the package.

The same links, outside the app:

* [Open Salesforce installer](https://login.salesforce.com/packaging/installPackage.apexp?p0=04tbm000000ndGLAAY) for a production or Developer org
* [Install in a sandbox](https://test.salesforce.com/packaging/installPackage.apexp?p0=04tbm000000ndGLAAY)
* [Download Salesforce package](https://app.cntillion.com/salesforce/centillion-salesforce.zip),
  the source, to deploy with the Salesforce CLI

The package adds the Apex bridge that calls Centillion, the triggers for
automatic replies, the **Centillion AI Draft Response** case action and both
permission sets. It carries no credentials. When you save **Configs**, Centillion
writes a private configuration record holding an encrypted secret, and adds a
Remote Site Setting for its own address.

It is an unmanaged package, so Salesforce cannot upgrade it in place. To update
an existing installation, deploy the updated source. Validate in a sandbox
before production.

## Choose how the agent replies

In **Configs**:

1. Under **Salesforce user**, pick the user the agent works as. The list shows
   the org's active users. The agent handles cases assigned to this user and
   sends its emails from that user's address. A user already assigned to
   another Centillion agent is refused until you unassign it there.
2. Set **Generate Draft Response**. Leave it off and the agent emails customers
   itself. Turn it on and the agent only prepares drafts for review.
3. Choose **Save**.

Saving adds the user's email address as an organization-wide email address in
Salesforce, and Salesforce sends a verification email to it. **Email
Verification Required** tells you which address to verify. Automatic replies
fail until it is verified, and cases that arrive before then are not answered
later. After you verify it, choose **Check verification**.

**Unassign user** stops the agent picking up new cases. Drafts on demand keep
working.

## Automatic replies

With a user saved, the package sends a case to Centillion when:

* a case is created already assigned to that user,
* a case is reassigned to that user,
* an incoming email arrives on an open case assigned to that user.

A case created by Email-to-Case is answered once, from its incoming email.
Ordinary case edits and outgoing emails start nothing.

Centillion reads the case with its latest comments and emails and writes a reply
with the model and instructions from **Overview**. It then checks that the case
is still open and still assigned to the agent's user, and emails the customer at
the case's contact email or supplied email. The email is sent from the user's
verified organization-wide address with the subject `RE:` and the case subject.
It is logged on the case with Salesforce's threading token. The agent never
posts case comments.

The agent does not answer closed cases or cases marked **Escalated**.

With **Generate Draft Response** on, the same cases get a stored draft instead
of an email, and no actions run. Teammates open it from the draft action below.

## Drafts in a case

Add the draft action to your case page once:

**1. Add the action**

Open a case in Salesforce and choose **Gear → Edit Page**. Select the
Highlights Panel, turn on Dynamic Actions if Salesforce asks, choose **Add
Action** and select **Centillion AI Draft Response**. Save and activate the
page.

**2. Generate a draft**

Open **Centillion AI Draft Response** on a case and click the button of the
same name. The draft appears as read-only text with **Copy to Clipboard**
and **Regenerate**.

**3. Send it yourself**

Paste the draft into Salesforce's email composer, edit it and send it. The
action never sends email.

The action opens on the case's latest stored draft. A teammate needs
**Centillion case responses** and access to the case, and can draft on any open
case they can open, assigned to the agent's user or not. Closed cases are
refused. If more than one Centillion agent is connected to the same org, drafts
work only on cases assigned to one of those agents' users. Drafts need a
Salesforce user saved in **Configs** at least once, keep working after
**Unassign user**, and stop when Salesforce is disconnected.

## Escalate a case to your team

To let the agent hand a case to a person, add a **Create ticket** tool. In
**Tools**, choose **Create ticket** and set **Ticket platform** to
**Salesforce**. Fill in **Tool name** and **When to use**, or turn on **Only
use in procedures**. Under **Channels**, select the Salesforce channel, then
choose **Save & enable**. The action needs [Centillion
Helpdesk](https://cntillion.com/docs/helpdesk.md#salesforce-support) turned on.

Salesforce case replies don't run free-form or structured
[procedures](https://cntillion.com/docs/agents/procedures.md). Leave **Only use in procedures** off for an
action the agent should use on Salesforce cases.

When the agent uses it on a Salesforce case, it marks that case **Escalated**
and stops replying to it automatically. It opens no new case and leaves the
owner as it was, so your team reviews the same case and its history. Clear
**Escalated** after review to let the agent answer the case again. To shape when
it escalates, such as every refund request, add that to the Salesforce
**Overview** instructions.

Draft mode never escalates.

## Create a case from a chat

The same **Create ticket** action, enabled on other channels, opens a new
Salesforce case when the agent hands a conversation off. It works on the chat
bubble, help page, Center Stage, email, phone, SMS, WhatsApp, the API and the
mobile SDKs. It is not available on Slack, Zendesk Messaging, Instagram or
Messenger.

The case gets the conversation's subject, a description with the transcript,
and the customer's name, email and phone when they are known. Its builder has no
details collection step: the details come from the conversation. The case is
marked **Escalated**, so the agent leaves it alone even if Salesforce assigns it
to the agent's user.

If Centillion cannot confirm that Salesforce created the case, it does not
retry, because a retry could create a second one. Check Salesforce before trying
again.

## Live chat

**Salesforce live chat** hands a website conversation to a person in Salesforce
through Enhanced Chat and Omni-Channel. It works on the chat bubble, help page
and Center Stage. Set up Salesforce first, then the action in Centillion.

**1. Turn on Messaging and Omni-Channel**

In Salesforce Setup, enable **Messaging Settings** and Omni-Channel.
Configure a messaging service channel, a routing queue, a presence status,
queue membership and agent capacity.

**2. Prepare your support agents**

Give them the **Enhanced Chat User** permission and access to the presence
status. Add Omni-Channel to the Service Console utility bar. On the
Messaging Session record page, add **Enhanced Conversation** and activate
the page for Service Console. Without it, chats route but the conversation
stays blank.

**3. Add Centillion's keyset**

In Centillion, open **Manage → Configs** for Salesforce, expand **Live chat
setup** and copy the keyset URL. In Salesforce, go to **Enhanced Chat User
Verification → JSON Web Keysets** and create an Endpoint keyset with that
URL. If Salesforce asks for a JWT issuer, enter the keyset URL's origin:
everything before `/api`, including `https://`.

**4. Create the messaging channel**

Create an **Enhanced Chat → Mobile** messaging channel and configure its
routing. Turn on **Add User Verification** and add an active User
Verification Configuration that uses the keyset.

**5. Publish a Custom Client deployment**

In **Embedded Service Deployments**, create an **Enhanced Chat → Custom
Client** deployment for that channel and publish it. Publishing can take up
to ten minutes. Then open **Install Code Snippet**. See Salesforce's
[Custom Client deployment
guide](https://help.salesforce.com/s/articleView?id=service.miaw_deployment_custom.htm\&type=5).

**6. Create the action in Centillion**

In **Tools**, choose **Salesforce live chat**. Set **Tool
name** and **When to use**, or turn on **Only use in procedures**. Copy
from the snippet:

| Snippet value | Field in Centillion |
| - | - |
| `Url` | **Salesforce Live Chat API URL**, an `https://` address ending in `salesforce-scrt.com` |
| `DeveloperName` | **Developer Name** |
| `OrganizationId` | **Org ID**, which must match the org you connected |

Turn on Centillion Helpdesk if it is off. Under **Channels**, choose Chat
bubble, Help page or Center Stage, then **Save & enable**.

**7. Test it on your website**

Put a Salesforce agent online in Omni-Channel. On a page with the deployed
chat, ask the agent for a person. Check messages in both directions, then
end the chat in Salesforce and check that the AI answers again. The
playground cannot start a live chat.

### How a handoff works

* Centillion opens the Salesforce chat and sends the reason for the handoff,
  then the conversation so far. The AI pauses only once Salesforce accepts the
  request. If Salesforce cannot be reached, the customer stays with the AI.
* Customer messages and your team's replies are synchronized while the website
  chat is open.
* When the Salesforce session ends, the AI takes over again. If Salesforce
  cannot route the chat, the customer is told live support is unavailable and
  can carry on with the AI.
* Only text is carried over. Attachments and interactive Salesforce message
  components are not shown.
* Salesforce sees a signed identity made for that one conversation, never the
  customer's email address.

## Limits

* Automatic replies depend on the user's verified organization-wide email
  address and on Salesforce's email limits.
* The draft action does not send email.
* If an automatic email times out after Salesforce may have accepted it,
  Centillion does not resend it. Check the case's emails before sending again.
* Each Salesforce event is answered once. A repeated event returns the reply
  already recorded.

## Disconnecting

Disconnect Salesforce from **Integrations** in your agent's sidebar. Case
replies and the Salesforce actions stop, the package configuration is removed
from your org and open live chats are closed. Contact syncing for this agent is
disconnected too. Existing cases and emails stay in Salesforce.

If a chat is still closing or Salesforce cannot be reached, disconnecting stops
halfway. The **Salesforce** card under **Channels** then offers **Finish
disconnecting**. Retry it once the problem clears.


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