> ## 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 Email in Salesforce

> Create Salesforce Cases from every email handoff so your reps work them from the console they already live in.

Email is the one channel that routes through [Case Management](/integrations/salesforce/email-cases), not Live Messaging. Every email handoff creates (or appends to) a Salesforce <Tooltip tip="A unit of work in Salesforce that tracks a single customer issue across comments, assignees, and status.">Case</Tooltip> so your reps work email the way Salesforce is designed to handle it — Cases with assignees, queues, and status tracking.

## Pre-requisites

<Warning>
  **Set up email forwarding first.** No email handoff has anything to Case until inbound mail is reaching OpenCX — start with [Connect Email](/email/forwarding) and come back here.
</Warning>

* **Email forwarding configured** — see [Connect Email](/email/forwarding).
* **Salesforce Email Cases credentials, webhook, and Apex configured** — see [Email Cases setup](/integrations/salesforce/email-cases).

## How conversations land in Salesforce

```mermaid theme={"dark"}
flowchart LR
  A[Customer emails your support address] --> B[AI replies from the same address]
  B --> C{AI can resolve?}
  C -- Yes --> D[Thread stays email-only]
  C -- No --> E[Handoff]
  E --> F[Salesforce Case created with transcript]
  F --> G[Rep replies on Case — lands in customer inbox]
```

## Setting up

<Steps>
  <Step title="Confirm email forwarding works">
    Open [**Channels → AI Email**](https://platform.open.cx/channels/configure/mail) in the OpenCX dashboard. Your forwarding address should be listed and verified. Send a test email and confirm it reaches the [Inbox](https://platform.open.cx/inbox).
  </Step>

  <Step title="Confirm Salesforce Email Cases is connected">
    In [**Settings → Integrations**](https://platform.open.cx/settings/integrations), open **Salesforce → Email**. The status should show **Connected** and the webhook URL should be displayed.
  </Step>

  <Step title="Confirm the Apex trigger is active">
    In Salesforce, go to **Setup → Apex Triggers** and verify the `CaseTrigger` fires on `Case (after insert)`. See [Email Cases setup](/integrations/salesforce/email-cases#configure-the-webhook-in-salesforce) for the exact code.
  </Step>

  <Step title="Trigger a test handoff">
    Send a test email to your connected address and respond with something that causes the AI to escalate. Alternatively, go to the [Inbox](https://platform.open.cx/inbox) and manually hand off the session.
  </Step>

  <Step title="Verify the Case in Salesforce">
    A Case should appear in Salesforce. Check:

    * The **conversation summary** is the Case description.
    * The **full transcript** is attached as Case comments.
    * `Case_From__c` is set to `opencx`.
    * The OpenCX session shows a `salesforce_case_id` linking to this Case.
  </Step>

  <Step title="Reply and verify sync">
    Reply on the Case from Salesforce. Confirm it arrives in the customer's email and shows as an agent message in the [OpenCX Inbox](https://platform.open.cx/inbox).
  </Step>
</Steps>

## What the rep sees

* A **Salesforce Case** with `Case_From__c` set to `opencx`.
* Conversation **summary as the description**, full transcript as Case comments.
* The OpenCX session linked via `salesforce_case_id` — visible in the [Inbox](https://platform.open.cx/inbox) session detail for tracing.
* Replies on the Case sync back to the contact's inbox.

## Channel-specific details

<AccordionGroup>
  <Accordion title="Case-append on returning contacts" icon="rotate">
    If the same contact re-engages before the Case is closed, OpenCX appends to the existing Case instead of opening a new one. Your reps keep context; your reports don't inflate.
  </Accordion>

  <Accordion title="Rep reply syncs back to the customer's inbox" icon="reply">
    When your rep replies on the Case, the webhook fires and OpenCX delivers the reply to the customer's original email thread. The AI stops auto-responding once a human agent is active on the session.
  </Accordion>

  <Accordion title="Attachments" icon="paperclip">
    Attachments the customer sends by email are included in the OpenCX session. Attachments your rep adds to a Case reply sync back through the customer's email thread (subject to your email provider's attachment limits).
  </Accordion>
</AccordionGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="AI Email Support" icon="envelope" href="/email/introduction">
    The channel itself — forwarding setup, flow, troubleshooting.
  </Card>

  <Card title="Email Cases setup" icon="plug" href="/integrations/salesforce/email-cases">
    OAuth, External Client App, webhook, and Apex configuration.
  </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">
    Cases not created, replies not syncing.
  </Card>
</CardGroup>
