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

# AI Chat Widget in Salesforce

> Route web chat conversations from the AI Chat Widget into the Salesforce console as live messaging threads.

Widget conversations route through <Tooltip tip="Salesforce's real-time messaging layer. Conversations appear in the console as live chats routed through Omni-Channel.">Messaging for In-App and Web</Tooltip>. When the AI hands off a chat, your rep picks it up as a live messaging thread inside the Salesforce console — no ticket created, no context lost.

## Pre-requisites

<Warning>
  **Install the AI Chat Widget on your site first.** Salesforce handoff has nothing to route until the widget is live — start with [Install Widget](/widget/install-widget) and come back here.
</Warning>

* **Widget installed and reachable** — see [Install Widget](/widget/install-widget).
* **Salesforce Live Messaging credentials saved** — see [Live Messaging setup](/integrations/salesforce/live-messaging).

## How conversations land in Salesforce

```mermaid theme={"dark"}
flowchart LR
  A[Visitor opens widget] --> B[AI answers]
  B --> C{AI can resolve?}
  C -- Yes --> D[Visitor closes the chat]
  C -- No --> E[Handoff via Live Messaging]
  E --> F[Messaging thread in Salesforce]
  F --> G[Rep replies — lands in the widget]
```

## Setting up

<Steps>
  <Step title="Confirm the widget is live">
    Open the page where you embedded the widget and send a test message. You should see the AI respond. If the widget doesn't load, walk through [Install Widget](/widget/install-widget) first.
  </Step>

  <Step title="Confirm Live Messaging is connected">
    In your [OpenCX dashboard](https://platform.open.cx/settings/integrations), open **Salesforce → MIAW**. All six fields should be filled and saved. If not, complete the [Live Messaging setup](/integrations/salesforce/live-messaging).
  </Step>

  <Step title="Trigger a test handoff">
    Send a message like *"I want to talk to a human"* in the widget. The AI should hand off the conversation.
  </Step>

  <Step title="Verify in the Salesforce console">
    The conversation should appear as a **messaging thread** routed through Omni-Channel. Reply from Salesforce and confirm the message lands in the visitor's widget within a couple of seconds.
  </Step>
</Steps>

<Tip>
  If the conversation doesn't appear in Salesforce, check that your Omni-Channel flow is configured for the Embedded Service Deployment. See [Troubleshooting](/integrations/salesforce/troubleshooting#live-messaging).
</Tip>

## What the rep sees

* A **messaging thread in the Salesforce console** routed through Omni-Channel.
* The full AI-to-visitor transcript attached to the conversation.
* Routing attributes including `OpencxSessionId` — the trace key back to the OpenCX session.
* Replies typed in the Salesforce console land back in the visitor's widget within a couple of seconds.

## Channel-specific details

<AccordionGroup>
  <Accordion title="Authenticated visitors vs anonymous visitors" icon="shield-check">
    When the widget passes a verified email via [widget authentication](/widget/authentication), OpenCX generates an authenticated identity token. Anonymous visitors get an unauthenticated token. Both flow through the same Embedded Service Deployment — your Omni-Channel flow can use the `Chat_Consumer_Type` routing attribute to route differently.
  </Accordion>

  <Accordion title="Files visitors upload" icon="paperclip">
    Files uploaded in the widget appear as attachments on the messaging thread in the Salesforce console. File-size limits follow your Salesforce org's messaging configuration.
  </Accordion>

  <Accordion title="Widget custom components still render on the visitor side" icon="bolt">
    When an AI action returns data rendered by a [custom component](/widget/custom-components), the visitor sees the richer UI. Your rep sees the underlying text in the Salesforce console — pick copy that reads well in both surfaces.
  </Accordion>

  <Accordion title="CSAT after the chat ends" icon="star">
    If your workflow triggers <Tooltip tip="Customer Satisfaction — a post-conversation survey measuring how satisfied the visitor was with the support experience.">CSAT</Tooltip>, the rating and comment land on the OpenCX session (visible in the [Inbox](https://platform.open.cx/inbox)), not in Salesforce.
  </Accordion>
</AccordionGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="AI Chat Widget" icon="messages" href="/widget/introduction">
    The channel itself — install, configure, authenticate.
  </Card>

  <Card title="Live Messaging setup" icon="plug" href="/integrations/salesforce/live-messaging">
    JWT credentials, routing attributes, and connection.
  </Card>

  <Card title="Salesforce overview" icon="cloud" href="/integrations/salesforce/overview">
    What Salesforce lights up across every channel.
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/integrations/salesforce/troubleshooting">
    Conversations not appearing, routing issues.
  </Card>
</CardGroup>
