Nền tảng
Tính năng
Studio đại lý
Xây dựng và tùy chỉnh đại lý của bạn một cách nhanh chóng
Động cơ tự động
Sử dụng LLMs để hướng dẫn các cuộc trò chuyện và nhiệm vụ
Cơ sở tri thức
Đào tạo bot của bạn với các nguồn kiến thức tùy chỉnh
Bảng
Lưu trữ và quản lý dữ liệu cuộc hội thoại
Kênh
Whatsapp Biểu tượng
WhatsApp
Instagram Biểu tượng
Instagram
Facebook Messenger biểu tượng
Messenger
Slack biểu tượng
Slack
Tất cả các kênh
Tích hợp
Biểu trưng Hubspot
HubSpot
Notion biểu tượng
Notion
Biểu tượng Jira
Jira
Calendly biểu trưng
Calendly
Tất cả các tích hợp
LLM Nhà cung cấp
OpenAI biểu trưng
OpenAI
Anthropic biểu trưng
Anthropic
Groq biểu trưng
Groq
Biểu tượng HuggingFace
Hugging Face
Tất cả LLMs
Giải pháp
Cho
Doanh nghiệp
Tự động hóa quy trình sản xuất quan trọng
Cơ quan
Cung cấp dịch vụ đại lý tinh vi
Nhà phát triển
Khám phá API mạnh mẽ để phát triển tác nhân
Câu chuyện của khách hàng
Khám phá từ những khách hàng thành công cách thức Botpress đang chuyển đổi hoạt động kinh doanh trên toàn thế giới.
Theo Ngành
Thương mại điện tử
Giáo dục
Tài chính
Hospitality
Tất cả các ngành công nghiệp
Theo Bộ phận
Bán hàng
Kỹ thuật
Sản phẩm
ITSM
Tất cả các phòng ban
Theo trường hợp sử dụng
Trợ lý mua sắm
Tạo khách hàng tiềm năng
Trải nghiệm của nhân viên
Quản lý vé
Tất cả các trường hợp sử dụng
Tài nguyên
Thiết yếu
Academy
Học cách xây dựng thông qua các khóa học được tuyển chọn
Thư viện
Tài nguyên để nâng cao quy trình làm việc AI của bạn
Tin tức
Thông tin chi tiết và cập nhật về Botpress và các tác nhân AI
xây dựng
Discord
Tham gia cùng hàng ngàn người bạn và chia sẻ ý tưởng
Documents
Hướng dẫn và tài liệu tham khảo toàn diện
API
Tài liệu tham khảo để sử dụng với các hệ thống bên ngoài
LLM Xếp hạng
So sánh hiệu suất và chi phí cho các nhà cung cấp mô hình
Video
Hướng dẫn, bản demo và hướng dẫn sử dụng sản phẩm
Nhật ký thay đổi
Cập nhật thông tin mới nhất Botpress cập nhật
Đối tác
Trở thành đối tác
Tham gia mạng lưới các chuyên gia được chứng nhận của chúng tôi
Thuê một chuyên gia
Kết nối với đối tác và chuyên gia tư vấn
Documents
Doanh nghiệp
Giá
Đăng nhập
Liên hệĐăng ký
quay lại Hub

Hộp thư đến HubSpot HITL

v5.0.1
Cài đặt trên Không gian làm việc của bạn
Được duy trì bởi Botpress Đội ngũ tăng trưởng
  
# HubSpot Custom Channels HITL (Human-in-the-Loop) Integration

This integration enables Botpress to escalate conversations from a chatbot to a live agent in a HubSpot Inbox via Custom Channels. It uses the HubSpot Custom Channels API to create, send, and manage HITL (Human-in-the-Loop) conversations and agent interactions.

## Note: This integration requires one of the following products or higher.
HubSpot Sales Hub - Enterprise

HubSpot Service Hub - Enterprise

### Escalate to Human - Phone Number Requirement

To successfully trigger HITL's **"Escalate to a Human"** card, you must pass a **valid phone number including the country code** into the **"User Email"** field.

> ⚠️ This phone number **must match** the number of an existing contact in HubSpot. If there’s no match, the escalation will not work.

## How It Works

### Conversation Start

- When a user requests live agent support, the bot:
  - Calls HubSpot’s Custom Channels API to start a new conversation thread.
  - Registers the custom channel and sends the initial "Name, title, description" message.

### Message Handling

- All subsequent user messages are:
  - Sent to HubSpot as INCOMING messages through the Custom Channels API.
  - Routed to the appropriate inbox and agent in the HubSpot Conversations UI.

### Operator Events Tracking

The integration listens for HubSpot webhook events, including:
- `operatorAssignedUpdate`: Fires when an agent joins the thread.
- `operatorSendMessage`: Captures replies sent by the agent.
- `operatorConversationCompleted`: Fires when the conversation is closed by the agent.

These events are handled in the `src/events/` directory and forwarded to Botpress via custom events like `hitlAssigned` and `hitlStopped`.

### Closing Conversations

- When an agent marks a conversation as complete, Botpress:
  - Recognizes the event via webhook.
  - Terminates the HITL session and notifies the bot.

## HubSpot Inbox HITL Integration Setup Guide

This guide walks you through connecting your HubSpot Inbox with Botpress using OAuth for Human-in-the-Loop functionality.

### **[Loom video walk through setting up the OAuth configuration.](https://www.loom.com/share/4f1671cfd4fd4063b5e8570830100a44?sid=a22987f8-858b-4ef2-a879-ccac762fb6aa)** ###


### 1. Create a HubSpot Developer Account
- Go to [HubSpot Developer](https://developers.hubspot.com/) and sign up or log in.

### 2. Create a Public App
- Navigate to **Apps** > **Create app**
- Set the **Redirect URL** to your Botpress webhook URL  
  Example: `https://your-botpress-url.com/api/v1/webhooks/hubspot`

### 3. Generate Your Developer API Key
- In your developer portal, go to **Keys**
- Generate a `developer_api_key`

### 4. Configure Your App Credentials in Botpress
In your Botpress integration config, paste the following values:
- `developer_api_key`
- `app ID`
- `client ID`
- `client secret`

### 5. Retrieve Your Inbox ID
- In HubSpot, go to:  
  **CRM** → **Inbox** → **Inbox Settings**
- Copy your Inbox ID from the URL:  
  Example:  
  `https://app-na3.hubspot.com/live-messages-settings/341662569/inboxes/1263703960/channels`  
  Here, the **Inbox ID** is: `1263703960`
- Paste this Inbox ID into your Botpress integration config.

### 6. Set App Scopes and Webhook
- In your public app settings, set the **Scopes** to:
  ```
  conversations.custom_channels.read
  conversations.custom_channels.write
  conversations.read
  conversations.visitor_identification.tokens.create
  conversations.write
  crm.objects.contacts.read
  ```
- Under **Webhooks**, set the **Target URL** to your Botpress webhook URL.

### 7. Subscribe to Webhook Events
Create webhook subscriptions for the following events:
- `conversations.newMessage`
- `conversation.propertyChange` (AssignedTo, Status)

---

## Get Your OAuth Refresh Token

### 1. Get the Authorization Code
Open the following URL in your browser (replace values accordingly):
```bash
https://app.hubspot.com/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=conversations.custom_channels.read%20conversations.custom_channels.write%20conversations.read%20conversations.visitor_identification.tokens.create%20conversations.write%20crm.objects.contacts.read&response_type=code
```

### 2. Exchange the Code for Tokens
Use the following cURL request to get your tokens:
```bash
curl -X POST https://api.hubapi.com/oauth/v1/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=authorization_code" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET" \
  -d "redirect_uri=YOUR_BOTPRESS_WEBHOOK_URL" \
  -d "code=YOUR_AUTHORIZATION_CODE"
```

You’ll receive:
- `access_token`
- `refresh_token`
- `expires_in`

Save your `refresh_token` in your Botpress integration settings.

> ⚠️ **Note:** After saving your final integration configuration in Botpress, it may take **over a minute** for the HubSpot channel to connect. **Do not refresh or close the page** during this time.

---

## You're All Set!
Your HubSpot inbox is now connected to Botpress HITL via OAuth. You should now be able to receive and respond to conversations within Botpress.

Xây dựng tốt hơn với Botpress

Tạo ra những trải nghiệm tuyệt vời cho tác nhân AI.

Bắt đầu - hoàn toàn miễn phí
Biểu tượng mũi tên
Tìm hiểu thêm tại Botpress Academy

Xây dựng các tác nhân AI tốt hơn và nhanh hơn với bộ sưu tập các khóa học, hướng dẫn và bài hướng dẫn được chúng tôi tuyển chọn kỹ lưỡng.

Thuê một chuyên gia

Kết nối với các nhà phát triển được chứng nhận của chúng tôi để tìm một chuyên gia xây dựng phù hợp với nhu cầu của bạn.

Tất cả các hệ thống hoạt động
SOC 2
Chứng nhận
GDPR
Tuân thủ
© 2025
Nền tảng
Giá
Studio đại lý
Động cơ tự động
Cơ sở tri thức
Bảng
Hub
Tích hợp
Kênh
LLMs
Tài nguyên
Nói chuyện với bộ phận bán hàng
Tư liệu
Thuê một chuyên gia
Video
Câu chuyện của khách hàng
Tài liệu tham khảo API
Tin tức
Tình trạng
v12 Tài nguyên
Cộng đồng
Hỗ trợ cộng đồng
Trở thành đối tác
Trở thành Đại sứ
Trở thành Đối tác liên kết
Công ty
Về
Nghề nghiệp
Tin tức & Báo chí
Hợp pháp
Sự riêng tư
© Botpress 2025