Skip to main content
The Email Cases path wires OpenCX into Salesforce Case Management. Use it for email — the channel where every handoff should become a trackable . Chat, SMS, WhatsApp, and phone belong on Live Messaging instead.
Setup takes about 30 minutes. You need a Salesforce System Administrator profile and admin access in OpenCX.

Before you start

Enterprise, Unlimited, or Developer edition. Professional edition requires API access to be enabled separately.
You need to create a Connected App, a Named Credential, an Apex Class, and an Apex Trigger. Standard user roles cannot reach these.
Required to save integration settings in Settings → Integrations.

Setup

1

Create a Connected App in Salesforce

In Salesforce, go to Setup → Apps → App Manager and click New Connected App.
  1. Fill in the basic information (App Name, API Name, Contact Email).
  2. Under API (Enable OAuth Settings), check Enable OAuth Settings.
  3. Set the Callback URL to:
    https://api.open.cx/backend/salesforce-case-management/oauth/callback
    
  4. Select scopes: Full access (full) and Perform requests at any time (refresh_token, offline_access).
  5. Check Require Secret for Web Server Flow.
  6. Check Require Secret for Refresh Token Flow.
  7. Click Save.
After saving, copy the Consumer Key and Consumer Secret from the app detail page.
It may take 2–10 minutes for a new Connected App to activate. If the next step fails immediately, wait and retry.
2

Enter credentials and connect

In your OpenCX dashboard, open Salesforce and select the Email tab.
FieldValue
Client IDThe Consumer Key from your Connected App.
Client SecretThe Consumer Secret from your Connected App.
Login URLhttps://login.salesforce.com for production. Use https://test.salesforce.com for sandbox environments.
Redirect URIAuto-populated. Do not change this value.
Click Save Credentials, then click Connect to Salesforce. A Salesforce login window opens — authorize the connection. When you return to OpenCX, the status shows Connected.
3

Configure the webhook in Salesforce

After connecting, OpenCX displays a Webhook URL. Copy it.
The webhook URL includes a secure token. Treat it like a password — do not share it publicly.
Create a Named Credential in Salesforce:
  1. Go to Setup → Named Credentials and click New Named Credential.
  2. Set Name to OpenCX_Integration.
  3. Paste the webhook URL into the URL field.
  4. Set Identity Type to Anonymous.
  5. Leave Authentication Protocol as No Authentication.
  6. Save.
Create the Apex Class:Go to Setup → Apex Classes, click New, and paste:
public class OpenSalesforceCaseManagement {
    @future(callout=true)
    public static void sendCaseEvent(Id caseId, String eventType) {
        String endpointUrl = 'callout:OpenCX_Integration?caseId=' +
            EncodingUtil.urlEncode(caseId, 'UTF-8');

        HttpRequest req = new HttpRequest();
        req.setEndpoint(endpointUrl);
        req.setMethod('POST');
        req.setHeader('Content-Type', 'application/json');
        req.setBody('');

        Http http = new Http();
        HttpResponse res = http.send(req);
        System.debug('OpenCX webhook response: ' + res.getBody());
    }
}
Create the Apex Trigger:Go to Setup → Apex Triggers, click New, select Case as the object, and paste:
trigger CaseTrigger on Case (after insert) {
    for (Case c : Trigger.new) {
        OpenSalesforceCaseManagement.sendCaseEvent(c.Id, 'CaseCreated');
    }
}
4

Verify end to end

Send a test email to an address connected to OpenCX. Escalate the conversation (or ask to speak with a human). Within a few seconds:
  1. A Case appears in Salesforce with Case_From__c set to opencx.
  2. Reply on the Case from Salesforce.
  3. The reply appears as an agent message on the matching session in your OpenCX Inbox.
If any step fails, jump to Troubleshooting.

How handoff lands in Salesforce

When triggers, OpenCX:
  1. Creates a Salesforce Case with the conversation topic as Subject and the AI summary as Description.
  2. Sets Case_From__c to opencx so your views and reports can filter to AI-escalated cases.
  3. Attaches the full transcript as Case comments.
  4. Stores the Salesforce Case ID on the OpenCX session for tracing.
  5. When your rep replies on the Case, the webhook fires and OpenCX delivers the reply to the contact’s inbox.
  6. When the Case is closed, the OpenCX session resolves.
If the same contact re-engages before the Case is closed, OpenCX appends to the existing Case instead of opening a new one.

Disconnecting

In OpenCX, open the Salesforce integration and click Disconnect. Then in Salesforce, delete the Named Credential (OpenCX_Integration) and the Apex Trigger/Class you created. Cases created while the integration was active remain untouched.

AI Email in Salesforce

Per-channel implementation details for email handoff.

Live Messaging

The path for chat, SMS, WhatsApp, and phone channels.

Troubleshooting

OAuth errors, missing Cases, webhook issues.

Handoff settings

Global handoff rules and office hours.