# Escalate AI agent conversations to Gorgias > Connect Gorgias so your AI agent can escalate a conversation by opening a ticket for your support team The Gorgias integration lets your QwryAI agent escalate a conversation by opening a ticket in Gorgias. It suits ecommerce teams that already work their support queue in Gorgias: the agent handles routine questions, then passes the rest on with an AI-written summary and a link to the full conversation. Tickets can be created from any channel where the [Escalations](/docs/user-guides/chatbot/actions/escalate-to-human) Action runs. ## Before you start * A QwryAI account with an agent, in a workspace that isn't HIPAA-compliant. On HIPAA-compliant workspaces the card shows *Not available on HIPAA-compliant accounts.* * Your Gorgias **subdomain**, the **email** of a Gorgias user, and that user's **API key**. See [Find your Gorgias API key](#find-your-gorgias-api-key). ## How to connect Gorgias **1. Open your agent** Sign in to your [QwryAI dashboard](https://www.qwryai.com) and select the agent you want to connect. **2. Connect Gorgias** Open **Integrations** and select **Connect** on the **Gorgias** card. ![The Gorgias card on the Integrations page, Connect Gorgias so that your AI agent can escalate tickets to humans., with the pointer on Connect.](annotated/01-integrations-card.webp "Integrations › Gorgias › Connect.") **3. Enter your subdomain, email and API key** A **Gorgias Integration** window opens: *Allow QwryAI to integrate with Gorgias?* Enter only the subdomain, such as `yourcompany`, between `https://` and `.gorgias.com`. Fill in **Account email** and **API Key**, then select **Submit**. The card then shows **Connected**. ![The Gorgias Integration window, Allow QwryAI to integrate with Gorgias?, with yourcompany typed between https:// and .gorgias.com, support@yourcompany.com in Account email, an empty API Key field with the hint You can create an API key in Gorgias under Settings → REST API., and the Close and Submit buttons.](annotated/02-connect-window.webp "Enter your subdomain, Account email and API Key.") **4. Create the Escalations Action** Create an **Escalations** Action with **Gorgias** as the **Ticket Platform**. See the [Escalations guide](/docs/user-guides/chatbot/actions/escalate-to-human). ### Find your Gorgias API key 1. Sign in to Gorgias as an admin. 2. Go to **Settings › REST API**. 3. Copy your **Username** (your account email) and create or copy an **API key**. > [!TIP] > > Test the integration by asking your agent to speak to a person, and check that a ticket appears in Gorgias. ## What the ticket contains The agent makes sure it has the customer's name and email first, asking for them if needed. QwryAI then creates an email ticket in Gorgias as if the customer had written in: | Gorgias field | What QwryAI sends | | - | - | | **Subject** | A short subject the agent writes from the customer's issue | | **Customer** | The customer's name and email | | **First message** | An AI-written summary of the issue, sent from the customer's email to your **Account email** | | **Channel** | Email | QwryAI then adds an internal note, *conversation link in QwryAI:*, with a link to the conversation in your QwryAI **Inbox**. Files from the chat aren't attached, and no tags or fields are set. ### Example ticket A customer writes that their parcel arrived damaged and they want a replacement. The agent asks for their name and email, then creates: * **Subject:** Damaged parcel, replacement requested * **First message:** My order arrived with the box crushed and the mug inside broken. I'd like a replacement. * **Internal note:** conversation link in QwryAI, followed by the link ### Repeat escalations in the same conversation If the same conversation escalates again while its earlier Gorgias ticket is still open, QwryAI doesn't open a second ticket. It adds the new summary to the open ticket as a customer message starting *Update:*. Once that ticket is closed (or deleted), the next escalation opens a new one. ## Ecommerce escalation examples * **Damaged or wrong items:** "My order arrived broken" → a ticket your team can refund or replace from Gorgias. * **Address changes after ordering:** "Can you change my delivery address?" No Shopify Action changes a placed order, so the agent escalates. * **Cancellations:** "Please cancel my order" → a ticket for your team to cancel in Shopify. ## What the customer sees The agent tells the customer the ticket was created and keeps replying in the chat. Your team's replies from Gorgias reach the customer by email and don't appear in the chat. If Gorgias refuses the ticket, the customer is told it couldn't be created. ## Troubleshooting > [accordion] Connecting shows "Invalid email or API key." > > Gorgias rejected the email and key pair. Copy both again from **Settings › REST API** and try again. > [accordion] Connecting shows "Invalid subdomain." or "Failed to connect to Gorgias. Please check your subdomain." > > Enter only the part before `.gorgias.com`, such as `yourcompany`. > [accordion] The customer was told the ticket could not be created > > Open the conversation in [Inbox](/docs/user-guides/chatbot/activity). The usual cause is an API key that was deleted in Gorgias: disconnect and connect again with a current key. > [accordion] A second escalation didn't open a new ticket > > That's expected while the first ticket is still open: the new request is added to it as an *Update:* message. > [accordion] Tickets aren't appearing in Gorgias > > Check that the **Create ticket** Action is enabled, uses **Gorgias**, is on for the channel you're testing, and that its **When to use** covers the request. > [!NOTE] > > A failed ticket doesn't send an email or alert. Check the conversation in **Inbox** when a customer reports that escalation didn't work. ## Frequently asked questions > [accordion] Why does the Gorgias ticket look like the customer emailed us? > > QwryAI creates it as an email ticket from the customer, so your team can reply straight from Gorgias and the reply reaches the customer by email. > [accordion] Can the agent tag the ticket or set ticket fields? > > No. Use Gorgias rules to tag or route tickets once they arrive. > [accordion] Can my team reply to the customer in the chat from Gorgias? > > No. Replies go by email. > [accordion] Does creating a ticket use extra credits? > > No. Only the agent's reply uses credits, as usual. > [accordion] What happens to my Escalations Actions if I disconnect Gorgias? > > Disconnecting deletes the **Create ticket** Actions that use Gorgias. The confirmation dialog lists them first. ## Next steps > [card] Escalations Action | /docs/user-guides/chatbot/actions/escalate-to-human | Choose when your agent escalates, which details it collects and which channels it escalates from.