# Escalate AI agent conversations to HubSpot > Connect HubSpot so your AI agent can escalate a conversation by opening a HubSpot ticket for your support team The HubSpot integration lets your QwryAI agent escalate a conversation by creating a ticket in your HubSpot account. Your agent handles routine questions, and when a customer needs a person, it creates a ticket with an AI-written summary, links it to the customer's HubSpot contact, and adds a note with 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. * A HubSpot account, and a HubSpot user who can install apps in it. ## How to connect HubSpot **1. Open your agent** Sign in to your [QwryAI dashboard](https://www.qwryai.com) and select the agent you want to connect. **2. Connect HubSpot** Open **Integrations** and select **Connect** on the **HubSpot** card. A HubSpot window opens. Sign in, choose the HubSpot account, review the access QwryAI asks for (reading and writing contacts and tickets) and select **Connect app**. The window closes and the card shows **Connected**. ![The HubSpot card on the Integrations page, Connect HubSpot so that your AI agent can escalate tickets to humans., with the pointer on Connect.](annotated/01-integrations-card.webp "Integrations › HubSpot › Connect.") ## Create the Escalations Action Create an **Escalations** Action with **HubSpot** as the **Ticket Platform**. Two HubSpot fields appear: | Field | What to enter | | - | - | | **HubSpot pipeline ID (optional)** | The ID of the ticket pipeline to create tickets in. Leave it empty to use your account's default pipeline. Find it in HubSpot under **Settings › Objects › Tickets › Pipelines**. | | **HubSpot pipeline stage ID** | The ID of the stage new tickets land in. Leave it as `1` to use the default **New** stage. If you set a custom pipeline, enter a stage ID from that pipeline. | See the [Escalations guide](/docs/user-guides/chatbot/actions/escalate-to-human) for the rest of the Action. ![In the Create ticket Action, HubSpot is chosen as the Ticket Platform, the HubSpot pipeline ID field is left empty and the HubSpot pipeline stage ID stays 1; then a customer asks for a person in the Playground and a ticket appears in HubSpot with the note linking the conversation.](walkthroughs/hubspot-escalation.gif) > [!TIP] > > Test the integration by asking your agent to speak to a person, and check that the ticket appears in HubSpot under **Tickets**. ## What the ticket contains The agent makes sure it has the customer's name and email first, asking for them if needed. | HubSpot field | What QwryAI sends | | - | - | | **Ticket name** | A short subject the agent writes from the customer's issue | | **Ticket description** | An AI-written summary of the issue, from the customer's point of view | | **Pipeline** | The Action's **HubSpot pipeline ID**, or your default pipeline | | **Ticket status** | The Action's **HubSpot pipeline stage ID** | | **Contact** | The HubSpot contact with the customer's email. If none exists, QwryAI creates one with their first and last name. | QwryAI then adds a note to the ticket, *conversation link in QwryAI:*, with a link to the conversation in your QwryAI **Inbox**. ### Example A customer asks to upgrade to an annual plan with a team discount. The agent asks for their name and email, then creates: * **Ticket name:** Annual plan upgrade with team discount * **Ticket description:** I'd like to move our team to the annual plan and ask whether a discount applies for 12 seats. * **Contact:** Alex Kim, alex@example.com * **Note:** conversation link in QwryAI, followed by the link ## What the customer sees The agent tells the customer the ticket was created and keeps replying in the chat. If HubSpot refuses the ticket, the customer is told *The support ticket could not be created, so the request has not been sent to a human agent.* Your team's replies from HubSpot reach the customer the way HubSpot sends them, usually by email, and don't appear in the chat. ## Managing the integration ### Disconnect HubSpot On **Integrations**, open the **Manage HubSpot connection** menu on the **HubSpot** card and select **Disconnect**. The dialog lists the **Create ticket** Actions that use HubSpot; confirming deletes them. ### Uninstall the app Disconnecting the last agent that uses a HubSpot account also uninstalls the QwryAI app from that account, so you don't need to remove it in HubSpot. If you uninstall it in HubSpot first, the card still shows **Connected** and tickets fail until you disconnect and connect again. ## Troubleshooting > [accordion] Connecting fails with "Failed to connect HubSpot" > > HubSpot didn't finish the authorization. Check that you can install apps in that HubSpot account, then select **Connect** again. > [accordion] HubSpot authorization expired > > *HubSpot authorization expired. Please reconnect.* The HubSpot window stayed open too long, or the grant was revoked. Connect again. > [accordion] The customer was told the ticket could not be created > > Open the conversation in [Inbox](/docs/user-guides/chatbot/activity). Common causes: > > * The **HubSpot pipeline stage ID** doesn't belong to the pipeline. Copy both IDs again from **Settings › Objects › Tickets › Pipelines**. > * The QwryAI app was uninstalled in HubSpot. The card still shows **Connected**: disconnect and connect again. > * The customer didn't give an email address. > [accordion] The Action won't save > > *Stage ID is required.* Enter a **HubSpot pipeline stage ID**, or put back `1`. ## Frequently asked questions > [accordion] Where do I find pipeline and stage IDs? > > In HubSpot, open **Settings › Objects › Tickets › Pipelines**, choose the pipeline, and copy the pipeline ID and the stage IDs it lists. > [accordion] Does QwryAI create duplicate contacts? > > No. It looks up the contact by email first and only creates one when none exists. > [accordion] Can several agents use the same HubSpot account? > > Yes. Connect HubSpot on each agent. Disconnecting one agent leaves the app installed while another agent still uses that account. > [accordion] What happens to my Actions if I disconnect HubSpot? > > Disconnecting deletes the **Create ticket** Actions that use HubSpot. The confirmation dialog lists them first. > [accordion] Does creating a HubSpot ticket use credits? > > No. Only the agent's reply uses credits, as usual. ## 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.