HubSpot Integration
Connect HubSpot Service Hub to TR-AI using a Private App token.
pat-). Replies are posted as Note engagements associated with the ticket — HubSpot Service Hub does not have a direct "reply" API on tickets.Credentials required
| Field | Where to find it |
|---|---|
| Access Token | HubSpot → Settings → Integrations → Private Apps → Create a private app → Auth tab → Access Token |
| Pipeline ID (optional) | HubSpot → Service → Tickets → Pipeline settings → Pipeline ID in the URL |
Step 1 — Create a Private App
- 1Open Private AppsGo to HubSpot → Settings → Integrations → Private Apps → Create a private app.
- 2Set required scopesUnder the Scopes tab, enable:
crm.objects.tickets.readcrm.objects.tickets.writecrm.objects.notes.readcrm.objects.notes.writecrm.schemas.tickets.read
- 3Copy the Access TokenAfter creating the app, go to the Auth tab and copy the Access Token.
Step 2 — Enter credentials in TR-AI
In your TR-AI Dashboard, open the HubSpot card. Paste your Access Token. Optionally enter a Pipeline ID to target a specific service pipeline. Click Save. TR-AI verifies by calling GET /account-info/v3/details.
Step 3 — Create a HubSpot Workflow webhook
- 1Create a Ticket-based workflowGo to HubSpot → Automation → Workflows → Create workflow → Ticket-based.
- 2Set the triggerTicket is created (for new tickets). For follow-ups, add a second workflow triggered on Ticket property updated when a reply is received.
- 3Add a webhook actionAdd action: Send a webhook. Set Method =
POSTand URL:
https://ticketresolve.ai/api/integrations/hubspot/webhook/{your-trial-id}- 1Set the request bodySelect Custom request body and paste:
{
"ticket_id": "{{ticket.hs_object_id}}",
"subject": "{{ticket.subject}}",
"description": "{{ticket.content}}",
"contact_name": "{{ticket.associations.contact.firstname}} {{ticket.associations.contact.lastname}}",
"contact_email": "{{ticket.associations.contact.email}}",
"event_type": "ticket.creation"
}How TR-AI replies to HubSpot tickets
HubSpot Service Hub does not have a "reply" endpoint on tickets. TR-AI creates a Note engagement associated with the ticket, which appears in the ticket timeline. The Note body contains the AI-generated resolution.
The process:
POST /crm/v3/objects/notes— creates the Note with the reply text.PUT /crm/v3/objects/notes/{noteId}/associations/tickets/{ticketId}/note_to_ticket— associates the Note with the ticket.
Pipeline stage management
TR-AI looks up pipeline stages at runtime via GET /crm/v3/pipelines/tickets and caches them for 10 minutes. Stage IDs vary per HubSpot portal — TR-AI never hard-codes them.
| Action | Stage used |
|---|---|
| Auto-resolved | Stage with metadata.isClosed=true, or label containing "Closed" |
| Triage | Stage with label containing "Waiting on Us" — falls back to "Waiting on Contact" |
Triage behaviour
When TR-AI cannot auto-resolve a ticket, it:
- Posts a Note engagement with the acknowledgement text.
- Moves the ticket to the Waiting on Us stage (or Waiting on Contact as fallback).
- Sends a Slack notification if configured.
Follow-up detection
TR-AI treats a webhook as a follow-up when event_type contains reply, update, or propertychange. For follow-ups, latest_reply is used as the query body instead of description.