# HubSpot

Connect HubSpot so your AI agent can escalate a conversation by opening a ticket for your support team

## Overview

Integrating HubSpot with QwryAI lets your AI agent escalate customer issues to your human support team by creating a ticket directly in HubSpot. The ticket includes the customer's details and the conversation context, so your team can pick up where the AI agent left off.

### What you can do

Let the AI resolve routine questions on its own, and hand off to HubSpot the moment a case needs a person, with the full context already attached.

## Before you start

- A QwryAI Starter, Growth or Enterprise plan, or a QwryAI free trial
- A QwryAI AI agent
- A HubSpot account, and a HubSpot user with permission to install apps

## How to connect HubSpot

#### 1. Open your QwryAI AI agent

Go to your QwryAI dashboard and select the AI agent you want to connect.

#### 2. Connect HubSpot

Go to the Integrations tab, find HubSpot, and click Connect.

![Integrations page with the HubSpot card](/docs/screenshots/original/qwryai-hubspot-connect.png)

Integrations page with the HubSpot card

#### 3. Choose your HubSpot account

You will be redirected to HubSpot. Sign in if HubSpot asks you to, select the HubSpot account to connect, and click Choose Account.

![HubSpot asking which account to connect to QwryAI](/docs/screenshots/original/qwryai-hubspot-choose-account.png)

HubSpot asking which account to connect to QwryAI

#### 4. Approve the requested scopes

Review the requested permissions and click Connect app. QwryAI asks to view and create contacts and tickets, and nothing else.

![HubSpot asking to connect the QwryAI app](/docs/screenshots/original/qwryai-hubspot-consent.png)

HubSpot asking to connect the QwryAI app

> Until HubSpot finishes reviewing the QwryAI app, HubSpot may show an unverified app warning. To continue, type I accept the risk and click Connect.

#### 5. Confirm the connection

After approval, you will return to QwryAI and see HubSpot marked as Connected.

## Install from the HubSpot App Marketplace

You can also start from HubSpot. On the QwryAI listing in the HubSpot App Marketplace, click Install, choose your HubSpot account and approve the requested scopes.

HubSpot then opens QwryAI. Sign in, or create a QwryAI account and come back to the HubSpot listing, then choose the AI agent that creates your HubSpot tickets and click Connect HubSpot. You land on that agent's Integrations tab with HubSpot marked as Connected.

> Choose the agent within an hour of approving in HubSpot. After that, click Install on the listing again.

## What QwryAI creates in HubSpot

Each time your AI agent escalates a conversation, QwryAI creates the following in your HubSpot account.

- A ticket in the pipeline and stage you chose, with a short subject and a summary of the customer's issue.
- A contact: QwryAI finds the contact by email, or creates one with the customer's name and email, and associates it with the ticket.
- A note on the ticket with a link to the full conversation in QwryAI.

QwryAI reads HubSpot only to find an existing contact, and to check that a ticket or note it was creating wasn't already created. It doesn't change tickets or contacts after creating them.

The ticket also appears in QwryAI's Tickets, with an Open in HubSpot link next to its source.

## Create the Escalations Action

Create a ticket Action so your AI agent can open tickets in HubSpot.

#### 1. Create a ticket Action

Go to Build → Actions → Create Action → Escalations.

#### 2. Select HubSpot

Choose HubSpot as the ticket platform, then fill in the ticket fields.

- HubSpot pipeline ID (optional): the ticket pipeline to create tickets in. Leave it empty to use your portal's default pipeline. Find it in HubSpot under Settings → Objects → Tickets → Pipelines.
- HubSpot pipeline stage ID: the stage new tickets land in. Leave it as 1 to use the default New stage. If you set a custom pipeline, enter a valid stage ID from that pipeline.

![The Create ticket Action with HubSpot selected](/docs/screenshots/original/qwryai-hubspot-action.png)

The Create ticket Action with HubSpot selected

#### 3. Save and test

Save the Action and run a test conversation. The AI agent asks for the customer's name and email if it doesn't have them, creates the ticket, and tells the customer their ticket number. It keeps answering afterwards.

> Test the integration by asking your AI agent to speak to a human, and confirm a ticket appears in HubSpot with the conversation details attached.

## Managing the integration

#### Disconnect HubSpot

Go to the Integrations tab, find HubSpot, and click Disconnect. Disconnecting also deletes the Actions that create HubSpot tickets. It removes the QwryAI app from your HubSpot account unless another QwryAI AI agent is still connected to the same HubSpot account.

#### Uninstall the app

To uninstall QwryAI from HubSpot, follow HubSpot's uninstall guide at knowledge.hubspot.com/integrations/connect-apps-to-hubspot#uninstall-an-app. After that, your AI agent can't create HubSpot tickets and tells the customer their request wasn't sent. To use HubSpot again, disconnect HubSpot on the Integrations tab, then connect it again.

#### What happens to your data

- Tickets, contacts and notes already created in HubSpot stay in HubSpot.
- Conversations and tickets in QwryAI stay in QwryAI.
- QwryAI deletes its access to your HubSpot account and creates no more HubSpot tickets.

## Next steps

- [Escalate to Human: configure when your AI agent escalates, which details it collects first, and which channels it can escalate from](/docs/user-guides/actions/escalate-to-human)
