This integration is available from Configure > Integrations > Salesforce Messaging in Agent Studio.
Prerequisites
- A Salesforce org with Service Cloud and Messaging for In-App and Web enabled.
- Salesforce administrator access to create a Messaging channel and a Connected App.
- A PolyAI project with at least one Knowledge topic that should escalate to a human.
1. Set up Salesforce
PolyAI connects to Salesforce through the Bring Your Own Channel integration. You will need:- A Messaging channel in Salesforce Setup (Messaging Settings) for PolyAI to hand conversations into.
- A Connected App with OAuth enabled so PolyAI can authenticate against Salesforce’s Messaging API.
- Omni-Channel routing configured so that messages on this channel land in a queue or skill that human agents are subscribed to.
2. Connect from Studio
In Agent Studio, open Configure > Integrations and click Connect on the Salesforce Messaging tile. Paste the credentials and IDs from your Connected App and Messaging channel setup.3. Write the handoff function
Add a Python tool that returns the chat handoff payload. The empty object lets you pass routing hints later (queue or skill) if needed.4. Assign the function to a topic
Open the Knowledge topic that should escalate to a live agent, add an Action, and select thetransfer_to_salesforce function. When that topic fires, PolyAI delivers the utterance to the user, opens a Salesforce Messaging conversation, and proxies subsequent turns between the two sides.
You can call the same function from a flow step or directly via conv.call_handoff() if you need more dynamic routing.
5. Verify
- Start a session in your webchat widget (or send an SMS, if SMS is wired up) and steer the conversation into the topic you wired the handoff to.
- Confirm that the
utteranceis sent and that a new conversation appears in the Salesforce Omni-Channel inbox for the routing queue you configured. - Reply from Salesforce and confirm the message is delivered back to the user inside the original widget.
- End the session from the Salesforce side and confirm the widget shows the conversation as closed.
Related pages
Salesforce CRM
Customer record lookup and case management.
Chat handoff overview
All chat handoff integrations and the shared payload shape.

