> ## Documentation Index
> Fetch the complete documentation index at: https://chatbase.co/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 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 Chatbase Gorgias integration lets your AI agent escalate a conversation to your support team by opening a ticket in Gorgias. It's for ecommerce teams that run customer support in Gorgias and want the AI agent to answer routine questions, then hand the rest to a person with an AI-written summary and a link to the full conversation. Tickets can be created from any channel where the [Escalations](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md) Action runs, such as the Chat Bubble, Help Page, WhatsApp, Instagram, Messenger, and email.

> [card] What you can do:
>
> Let the AI resolve routine questions on its own, and hand off to Gorgias the moment a case needs a person, with the full context already attached.

**Availability:** Gorgias needs the Chatbase Basic plan or higher. Gorgias isn't available on [HIPAA-compliant](https://chatbase.co/docs/user-guides/workspace/hipaa-compliance.md) accounts.

## Before you start

* A Chatbase account on the Basic plan or higher, with an AI agent
* Your Gorgias **subdomain**, **account email**, and **API key** (see [Find your Gorgias API key](#find-your-gorgias-api-key))

## How to connect Gorgias

**1. Open your Chatbase AI agent**

Log in to your [Chatbase dashboard](https://www.chatbase.co/dashboard/) and select the AI agent you want to connect.

**2. Connect Gorgias**

Choose **Integrations**, then click **Connect** under Gorgias.

**3. Enter your subdomain, email, and API key**

To authorize the integration, you'll need your Gorgias subdomain, account email, and API key. See [Find your Gorgias API key](#find-your-gorgias-api-key) below.

Chatbase checks the email and API key together, so the email usually needs to be the one of the Gorgias user who owns the key. Escalation tickets are addressed to this email, and the internal notes Chatbase adds are posted as this user.

**4. Create the Escalations Action**

Configure your Escalations Action to route tickets to Gorgias. Follow the [Escalations Action guide](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md) to set it up.

### Find your Gorgias API key

1. Log in to your Gorgias account.
2. Go to **Settings > REST API**.
3. Create a new API key, or copy an existing one.
4. Paste the API key into the Chatbase integration form, along with your account email and subdomain.

![Gorgias connection form in Chatbase with the subdomain, account email, and API key fields](https://mintcdn.com/chatbase/0LltFcp54SicR55-/user-guides/integrations/images/gorgias/gorgias.png?fit=max\&auto=format\&n=0LltFcp54SicR55-\&q=85\&s=cd2f9f76f4dfd55c6c84bc9a8599c2bf)

> [!TIP]
>
> Test the integration by asking your AI agent to speak to a human, and confirm a ticket appears in Gorgias with the conversation summary attached.

The connection belongs to this AI agent only. Each AI agent connects to one Gorgias account, so repeat these steps on every AI agent that should escalate to Gorgias.

## What the ticket contains

When the AI agent escalates, it first asks the customer for their email and name. If the channel or contact record already has them, such as the sender's address on the email channel, those are used. Chatbase then creates the ticket through the Gorgias API:

| Part of the ticket | What Chatbase sends |
| - | - |
| **Channel** | Email. The ticket shows up as an email ticket created through the API, not as a chat. |
| **Customer** | The customer's name and email. |
| **Subject** | A short subject the AI agent writes from the customer's issue. The customer isn't asked for it. |
| **First message** | An AI-written summary of the issue, sent as an email from the customer's address to your connected Gorgias email. It's written from the customer's point of view and in the customer's language, so it reads as if the customer wrote it. |
| **Internal note** | A link to the conversation in your Chatbase dashboard, so your team can read the whole chat. |

Chatbase doesn't set tags, priority, or custom ticket fields in Gorgias, and the Action has no Gorgias-specific options. Files and images the customer sent in the chat aren't attached.

### Example ticket

For example, a customer on the Chat Bubble asks to change the shipping address on an order they placed this morning. No [Shopify Action](https://chatbase.co/docs/user-guides/chatbot/actions/shopify-actions.md#limitations) can change the address, so the AI agent asks for their name and email and creates a ticket like this:

* **Subject:** Change shipping address on recent order
* **Customer:** Jane Doe, [jane@example.com](mailto:jane@example.com)
* **First message:** I placed an order this morning and need the shipping address changed to my new address before it ships.
* **Internal note:** conversation link in Chatbase, followed by the link to the conversation

### Repeat escalations in the same conversation

If the same conversation already created a Gorgias ticket that's still open, a new escalation doesn't open a second ticket. The new request is added to the existing ticket as a message starting with "Update:", and the AI agent tells the customer their existing ticket was updated. If that ticket is closed, deleted, or can't be found, Chatbase creates a new one.

## Ecommerce escalation examples

Escalate to Gorgias when the AI agent can't complete a request on its own. Common cases:

* **Order changes that no Action can make.** Shopify Actions can't cancel an order or change its shipping address. Add these to the Action's **When to use** so the AI agent opens a Gorgias ticket for them. See [When should the AI agent escalate?](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md#when-should-the-ai-agent-escalate)
* **The customer asks for a person.** For example, a customer unhappy with a delivery asks to speak to someone. The AI agent collects their email and name and creates the ticket.
* **Questions the AI agent can't answer from its content,** after confirming with the customer, as the default **When to use** does.

Chatbase doesn't send an order number or any Shopify data to Gorgias as a ticket field. Details such as an order number the customer mentioned reach the ticket only through the AI-written summary, and your team can open the linked conversation for the rest.

## What the customer sees

The AI agent tells the customer the ticket was created and shares the ticket number. On the Chat Bubble and other widget channels, a **Ticket Created** card also shows the ticket number and the name and email it was submitted with. If the ticket can't be created, the card reads **Failed to create ticket**. On WhatsApp, Instagram, and email, the customer gets the AI agent's message only.

The AI agent keeps replying in the chat after the ticket is created. Because the ticket is an email ticket, your team's replies from Gorgias usually reach the customer by email, not in the original chat.

Nothing syncs back from Gorgias. Chatbase stores the ticket number on the conversation, but not the ticket's status or your team's replies.

## Troubleshooting

> [accordion] Connecting shows "Invalid email or API key."
>
> Gorgias rejected the email and key as a pair. Copy the key again from **Settings > REST API** in Gorgias, and check that the email is the one of the Gorgias user who owns the key.

> [accordion] Connecting shows "Invalid subdomain." or "Failed to connect to Gorgias. Please check your subdomain."
>
> The subdomain doesn't match a Gorgias account. Enter only the part before `.gorgias.com`, for example `yourstore`.

> [accordion] The customer saw "Failed to create ticket"
>
> Open the conversation in [Activity](https://chatbase.co/docs/user-guides/chatbot/activity.md) and check the **Result** of the Action call for the error Gorgias returned. Common causes:
>
> * The API key was revoked or regenerated. The Gorgias card still shows **Connected**, so disconnect and connect again with a current key.
> * The customer didn't give an email address. Gorgias may reject a ticket without one.

> [accordion] A second escalation didn't open a new ticket
>
> This is expected. While the conversation's earlier Gorgias ticket is open, new requests are added to it as a message starting with "Update:". Look for the update on the existing ticket.

> [accordion] Tickets aren't appearing in Gorgias
>
> Check that the **Create ticket** Action is enabled, uses **Gorgias** as the **Ticket Platform**, and is turned on for the channel you're testing. Check its **When to use** instructions too, because the AI agent only creates a ticket when those conditions are met. If you saved changes, click **Publish** so the live AI agent uses them.

> [!NOTE]
>
> Failed tickets don't send an email or alert. Check the conversation in **Activity** when a customer reports that escalation didn't work.

## Frequently asked questions

> [accordion] Why does the Gorgias ticket look like the customer emailed us?
>
> Chatbase creates the ticket on the email channel, with the AI-written summary as the customer's first message. The summary is written from the customer's point of view, and an internal note links to the full conversation in Chatbase.

> [accordion] Does Chatbase send the Shopify order number to Gorgias?
>
> No. Only the subject, the customer's name and email, and the summary are sent. An order number appears on the ticket only if the AI agent includes it in the summary.

> [accordion] Can the AI agent tag the ticket or set ticket fields?
>
> No. Gorgias tickets from Chatbase have no tags, priority, or custom fields.

> [accordion] Can my team reply to the customer in the chat from Gorgias?
>
> No. Replies from Gorgias don't appear in the Chat Bubble or any other Chatbase channel. Because the ticket is on the email channel, they usually reach the customer by email.

> [accordion] Does creating a ticket use extra message credits?
>
> No. The ticket itself costs nothing extra. The reply in which the AI agent creates it is charged like any reply that calls an Action. See [Credit usage](https://chatbase.co/docs/user-guides/chatbot/actions/actions-overview.md#credit-usage).

> [accordion] What happens to my Escalations Actions if I disconnect Gorgias?
>
> Disconnecting deletes the **Create ticket** Actions that use Gorgias. A confirmation dialog lists them before anything is deleted.

## Next steps

> [card] [Escalations Action](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md)
>
> Configure when your AI agent escalates, which details it collects first, and which channels it can escalate from.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.