# Salesforce Actions: create cases and hand off to live agents > Open Salesforce cases and connect customers to live agents in Salesforce when your AI agent needs to escalate Salesforce Actions let your QwryAI agent pass on what it can't resolve to a team that works in Salesforce, in two ways: open a case for follow-up (**Create ticket**), or hand the customer to a live Salesforce agent in the chat (**Salesforce live chat**). Pick the one that fits how urgent the issue is, or use both. > [!NOTE] > > **Prerequisite:** connect Salesforce to your agent under **Integrations** before you add either Action. For a sandbox, or an org that blocks login.salesforce.com, enter your **Custom domain (optional)**, such as `acme.my.salesforce.com`, before you select **Connect**. See [Salesforce](/docs/user-guides/integrations/salesforce). ![The Integrations page filtered to Salesforce, with the pointer on the Connect button of the Salesforce card.](annotated/05-integrations.webp "Integrations › Salesforce › Connect.") ## Available Salesforce Actions | Action | What it does | | - | - | | [Create ticket](#1-create-ticket) | Opens a case in Salesforce for an issue your team can follow up later | | [Salesforce live chat](#2-salesforce-live-chat) | Connects the customer to a human agent in Salesforce in real time | > [!NOTE] > > **Create ticket** is the Salesforce option of the shared [Escalations](/docs/user-guides/chatbot/actions/escalate-to-human) Action. That page compares every ticket platform side by side. ## How to create a Salesforce Action Both Actions start the same way. The [Action sections](#actions) below cover only what differs. **1. Open Create Action** Open your agent, go to **Build › Actions** and select the **Create Action** tab. Type `Salesforce` in **Search** to find the card. ![The Create Action tab with Salesforce typed in Search, showing the Salesforce live chat card.](annotated/00-search.webp "Search Create Action for Salesforce.") **2. Pick the Action** For a case, select **Escalations**. For live chat, select **Salesforce live chat**. If Salesforce isn't connected yet, the **Salesforce live chat** dialog offers **Connect Salesforce**, which sends you to Salesforce to authorize access. ![The Create Action gallery with the pointer on the Salesforce live chat card, which hands over from the AI agent to live chat with a human support agent.](annotated/01-gallery.webp "Create Action › Salesforce live chat.") ![The Connect Salesforce dialog explaining you'll be redirected to Salesforce to authorize access, with a Connect button.](annotated/01-gallery--open.webp "Connect Salesforce first.") **3. Configure General** Give the Action an **Action name** and a **When to use** that says when the agent should use it. Each Action's section below suggests what to write. To run the Action only from a [Procedure](/docs/user-guides/chatbot/procedures/procedures-overview) step, turn on [**Only use in Procedures**](/docs/user-guides/chatbot/actions/actions-overview#only-use-in-procedures). **When to use** is then hidden. **4. Add the Action's own settings** **Create ticket** needs **Ticket Platform** set to **Salesforce**. **Salesforce live chat** needs your Salesforce org set up and three values from it. **5. Choose channels** Turn the Action on or off for each configured channel. **Create ticket** works on most channels, including messaging, email and Phone. **Salesforce live chat** works only on the **Chat bubble** and the **Help page**. See [Channels](/docs/user-guides/chatbot/actions/actions-overview#channels). **6. Enable and test** Select **Enable**, then test with the check listed in the Action's section. ## Actions ### 1. Create ticket Open a case in Salesforce when the agent can't solve the customer's problem and it doesn't need a person right away. The customer gets a follow-up from your team without waiting in the chat. **Best for:** non-urgent issues your team can handle asynchronously, and making sure every request is logged in Salesforce. **Common use cases:** * "The agent couldn't answer my billing question" * "I want to report a bug" * "Can someone follow up with me about this?" #### Settings **Action:** **Escalations**. **Ticket Platform:** **Salesforce**. The dropdown lists **QwryAI** and every helpdesk you've connected, so Salesforce appears once it's connected. ![The Ticket Platform dropdown of a new Escalations Action open, listing QwryAI, the only platform while no helpdesk is connected.](annotated/04-escalations.webp "Ticket Platform lists connected helpdesks.") **When to use:** when the agent should open a case. For example: ```text - Use this action when you cannot answer the user's question or solve their problem - Use this action when the user explicitly asks for a ticket or case - Use this action for non-urgent issues that don't need immediate human help - Do not use this action if the user needs help right now or says it's urgent ``` #### What the case contains The case fields are fixed: | Case field | Value | | - | - | | **Subject** | Written by the agent from the customer's issue | | **Description** | A first-person summary of the conversation | | **Case Origin** | `Web` | | **Web Email** | The customer's email. The agent asks for it if it doesn't know it. | | **Web Name** | The customer's name. The agent asks for it if it doesn't know it. | QwryAI also adds a private case comment linking to the conversation in QwryAI. > [!TIP] > > Ask your agent something it can't answer and request a follow-up. A new case should appear in Salesforce with the conversation summary. ### 2. Salesforce live chat Connect the customer to a human agent in Salesforce when the agent can't solve the problem and it needs a person now. **Best for:** urgent issues, problems that need real-time troubleshooting, and frustrated customers who want a person straight away. **Common use cases:** * "I need to speak to a human right now" * "This is urgent" * "The bot isn't helping, connect me to support" #### Configure your Salesforce org Set up your org for Enhanced Chat before you create the Action. Do these in order, in Salesforce **Setup**. **1. Turn on Messaging** In **Quick Find**, search for **Messaging Settings** and turn messaging on. **2. Set up Omni-Channel** Search for **Omni-Channel** and follow the setup to configure: * **Service Presence:** your agents' statuses, such as Available and Busy * **Routing Configurations:** how chats are routed to agents * **Service Channels:** the channel Omni-Channel routes chats through * **Agent Workload:** how many chats each agent takes at once **3. Add a JSON Web Keyset for user verification** QwryAI signs each customer in to Salesforce with a short-lived token, and Salesforce checks it against your agent's public keys. * Search for **Enhanced Chat User Verification** and open **JSON Web Keysets**. * Select **New** and choose **Endpoint** as the type. * Paste the **JSON Web Keyset URL** from your Salesforce live chat Action (copy it with **Copy** in the editor) as the **Endpoint URL**, and enter the same URL as the **JSON Web Key Issuer**. * Save. > [!NOTE] > > The keyset holds your agent's key once the Salesforce live chat Action has been saved, so save the Action first if Salesforce can't read any keys. **4. Create a messaging channel** * Back in **Messaging Settings**, select **New Channel**, choose **Enhanced Chat**, then **Mobile** as the deployment type. * Set routing from your Omni-Channel setup and save. * Select **Add User Verification** and save again. * Open the new channel, find **User Verification Configuration**, select **New**, pick the keyset from step 3, name it, keep **Active** on and save. > [!WARNING] > > User verification must be on for the messaging channel. Without it, Salesforce refuses the handoff and the agent keeps the conversation. **5. Create an Embedded Service Deployment** * Search for **Embedded Service Deployments** and select **New Deployment**. * Choose **Enhanced Chat**, then **Custom Client**. * Name it, for example `QwryAI`, and pick the messaging channel from step 4. Save. * Select **Publish** and check the deployment is **Active**. * Select **Install Code Snippet** and note the **OrganizationId**, **DeveloperName** and **Url** values. You need them for the Action. #### Settings **Action:** **Salesforce live chat**. The **Action name** starts as `Salesforce_Live_Chat`. **When to use:** when the agent should bring in a live agent. For example: ```text - Use this action when you cannot solve the user's problem and they need help right now - Use this action when the user explicitly asks to speak with a person - Use this action for urgent, time-sensitive issues or when the user is frustrated - Do not use this action for non-urgent issues that a support ticket can handle ``` **Salesforce Live Chat API URL:** the **Url** value from **Install Code Snippet**, for example `https://yourcompany.my.salesforce-scrt.com`. QwryAI shows *Invalid URL* if it isn't a valid web address. **Developer Name:** the **DeveloperName** value. **Org ID:** the **OrganizationId** value. **JSON Web Keyset URL:** read-only. Copy it into the keyset from step 3. #### What the customer sees 1. When the agent starts the handoff, the Salesforce agent receives a summary of the customer's request as the first message. 2. The customer sees **Waiting for support agent to join** with a spinner above the message box, until a Salesforce agent replies. 3. The customer and the Salesforce agent chat in real time in the widget. 4. When the Salesforce agent ends the session, the chat notes *Salesforce live chat ended.* and your QwryAI agent answers the customer's next message again. QwryAI sets no waiting timeout. What happens when nobody is available depends on your Omni-Channel routing. If Salesforce refuses the handoff, for example because a value is wrong or the keyset isn't registered, no live chat starts and the agent keeps the conversation. > [!TIP] > > Test from the Chat bubble on a published agent: ask for a person and check the chat is routed to an available agent in Salesforce. ## Best practices > [card] Clear escalation criteria | /docs/user-guides/chatbot/actions/escalate-to-human | Use **When to use** to separate the two paths: a case for issues that can wait, live chat for issues that can't. > [card] Complete case information | /docs/user-guides/integrations/salesforce | Let the agent collect the customer's name and email before it opens a case, so your team can reply. > [card] Test both paths | /docs/user-guides/chatbot/playground | Try urgent and non-urgent requests before going live, and check each lands where you expect. > [card] Match Actions to channels | /docs/user-guides/chatbot/channels | Turn live chat off on channels or at times when nobody covers Salesforce, so the agent doesn't offer what it can't deliver. ## Limitations * **Case fields are fixed.** **Create ticket** always fills the same five fields plus a private comment. * **No waiting timeout in QwryAI.** Live chat waits until a Salesforce agent joins; routing is up to Salesforce. * **Live chat is browser-only.** It runs on the Chat bubble and the Help page, not on messaging or email channels. ## Frequently asked questions > [accordion] Should I use Create ticket or Salesforce live chat? > > Use **Create ticket** for issues your team can follow up later. Use **Salesforce live chat** when the customer needs a person now and you have agents available. You can enable both and describe the difference in each **When to use**. > [accordion] Which fields does the Salesforce case get? > > **Subject**, **Description** (a summary of the conversation), **Case Origin** set to `Web`, **Web Email** and **Web Name**, plus a private comment linking to the conversation. > [accordion] What does the customer see while waiting? > > **Waiting for support agent to join** with a spinner, until the Salesforce agent's first message arrives. > [accordion] Does the agent take over after the Salesforce agent ends the chat? > > Yes. The chat shows *Salesforce live chat ended.* and the agent answers the customer's next message. > [accordion] Which Salesforce values does live chat need? > > **Salesforce Live Chat API URL**, **Developer Name** and **Org ID**, from **Install Code Snippet** on your Embedded Service Deployment. Salesforce in turn needs the **JSON Web Keyset URL** shown in the Action. ## Next steps > [card] Salesforce integration | /docs/user-guides/integrations/salesforce | Connect Salesforce to your agent. > [card] Escalations | /docs/user-guides/chatbot/actions/escalate-to-human | Every ticket platform, side by side. > [card] QwryAI live chat | /docs/user-guides/chatbot/actions/qwryai-live-chat | Hand chats to your own team inside QwryAI.