---
title: "HubSpot Connector"
description: "คู่มือการผสานรวม HubSpot CRM ฉบับสมบูรณ์สำหรับการซิงค์ผู้ติดต่อ บริษัท ดีล ตั๋ว และข้อมูลการตลาดกับ Brevo ผ่าน Tajo"
url: https://tajo.io/th/docs/connectors/crm/hubspot/
markdown: https://tajo.io/th/docs/connectors/crm/hubspot.md
lang: th-TH
robots: noindex
---

ขอสิทธิ์ใช้งานล่วงหน้า

กรอกชื่อและที่อยู่อีเมลที่ทำงานของคุณ เราจะส่งลิงก์เพื่อยืนยันคำขอเข้าใช้งาน Tajo ทางอีเมล

# HubSpot Connector

สถานะตัวเชื่อม: กำลังพัฒนา กำลังสร้าง ยังไม่ได้รับการยืนยัน

| ฟิลด์ต้นทาง | ฟิลด์ปลายทาง | ค่าตัวอย่าง |
| --- | --- | --- |
| `record.id` | `source_id` | `record_1042` |
| `record.updated_at` | `updated_at` | `2026-10-18T08:00:00Z` |
| `record.value` | `value` | `sample_value` |

เชื่อมต่อ HubSpot CRM กับ Brevo ผ่าน Tajo สำหรับการซิงค์ผู้ติดต่อแบบสองทิศทาง การติดตามดีล ข้อมูลการมีส่วนร่วม และระบบอัตโนมัติทางการตลาดแบบรวมศูนย์บนทั้งสองแพลตฟอร์ม

## ภาพรวม

| คุณสมบัติ | ค่า |
| --- | --- |
| **แพลตฟอร์ม** | HubSpot |
| **หมวดหมู่** | CRM |
| **ความซับซ้อนในการตั้งค่า** | ปานกลาง |
| **การผสานรวมอย่างเป็นทางการ** | ไม่ |
| **ข้อมูลที่ซิงค์** | ผู้ติดต่อ บริษัท ดีล ตั๋ว เหตุการณ์ |
| **API Base URL** | `https://api.hubapi.com` |

## ฟีเจอร์

- **การซิงค์ผู้ติดต่อแบบสองทิศทาง** - รักษาผู้ติดต่อให้ซิงค์กันระหว่าง HubSpot และ Brevo แบบเรียลไทม์
- **การติดตามไปป์ไลน์ดีล** - ซิงค์ขั้นตอนและมูลค่าดีลสำหรับการแบ่งกลุ่มตามรายได้
- **การซิงค์ข้อมูลบริษัท** - เชื่อมโยงผู้ติดต่อกับบันทึกบริษัทและข้อมูลองค์กร
- **การผสานรวมตั๋ว** - ติดตามตั๋วสนับสนุนสำหรับการให้คะแนนสุขภาพของลูกค้า
- **การติดตามการมีส่วนร่วม** - ซิงค์การเปิดอีเมล การคลิก การประชุม การโทร และบันทึก
- **รองรับอ็อบเจกต์แบบกำหนดเอง** - แมป HubSpot custom objects กับแอตทริบิวต์ Brevo
- **ทริกเกอร์เวิร์กโฟลว์** - ใช้การเปลี่ยนแปลงขั้นตอนวงจรชีวิต HubSpot เพื่อทริกเกอร์ระบบอัตโนมัติ Brevo
- **เหตุการณ์ Webhook** - การแจ้งเตือนแบบเรียลไทม์สำหรับการเปลี่ยนแปลงข้อมูล CRM

## ข้อกำหนดเบื้องต้น

ก่อนเริ่มต้น ตรวจสอบให้แน่ใจว่าคุณมี:

1. บัญชี HubSpot (Free, Starter, Professional หรือ Enterprise)
2. Private app หรือ OAuth app ของ HubSpot พร้อม scopes ที่จำเป็น
3. บัญชี Brevo ที่มีสิทธิ์เข้าถึง API
4. บัญชี Tajo

## การยืนยันตัวตน

### Private App Access Token (แนะนำ)

สร้าง private app ใน HubSpot สำหรับการเข้าถึง API โดยตรงพร้อมการควบคุม scope แบบละเอียด

1. ไปที่ HubSpot Settings > Integrations > Private Apps
2. สร้าง private app ใหม่
3. กำหนดค่า scopes ที่จำเป็น
4. คัดลอก access token

```bash
curl -X GET "https://api.hubapi.com/crm/v3/objects/contacts" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json"
```

### OAuth 2.0

ใช้ OAuth 2.0 สำหรับการผสานรวมหลายบัญชีที่ต้องการการอนุญาตจากผู้ใช้

```bash
# Authorization URL
https://app.hubspot.com/oauth/authorize?client_id={client_id}&scope=crm.objects.contacts.read&redirect_uri={redirect_uri}
```

#### Scopes ที่จำเป็น

```
crm.objects.contacts.read
crm.objects.contacts.write
crm.objects.companies.read
crm.objects.deals.read
crm.objects.deals.write
crm.objects.custom.read
crm.schemas.custom.read
```

## การกำหนดค่า

### การตั้งค่าพื้นฐาน

```yaml
connectors:
  hubspot:
    enabled: true
    access_token: "${HUBSPOT_ACCESS_TOKEN}"

    # Data sync options
    sync:
      contacts: true
      companies: true
      deals: true
      tickets: true
      engagements: true

    # Sync direction
    direction: bidirectional  # or 'hubspot_to_brevo' | 'brevo_to_hubspot'

    # List assignment in Brevo
    lists:
      all_contacts: 10
      qualified_leads: 11
      customers: 12
```

### การแมปฟิลด์

แมปคุณสมบัติ HubSpot กับแอตทริบิวต์ผู้ติดต่อ Brevo:

#### การแมปค่าเริ่มต้น

| Parameter | Type | Description |
| --- | --- | --- |
| `email` required | string | อีเมลผู้ติดต่อ (ตัวระบุหลัก) |
| `firstname` optional | string | แมปกับแอตทริบิวต์ FIRSTNAME ใน Brevo |
| `lastname` optional | string | แมปกับแอตทริบิวต์ LASTNAME ใน Brevo |
| `phone` optional | string | แมปกับแอตทริบิวต์ SMS สำหรับ WhatsApp/SMS |
| `company` optional | string | ชื่อบริษัทที่เกี่ยวข้อง |
| `lifecyclestage` optional | string | ขั้นตอนวงจรชีวิต HubSpot (subscriber, lead, MQL, SQL, customer) |
| `hs_lead_status` optional | string | สถานะการคัดเลือกลีด |
| `hubspot_owner_id` optional | string | รหัสเจ้าของฝ่ายขายที่ได้รับมอบหมาย |

#### การแมปคุณสมบัติแบบกำหนดเอง

```yaml
field_mapping:
  # Standard fields
  email: email
  firstname: FIRSTNAME
  lastname: LASTNAME
  phone: SMS

  # CRM fields
  lifecyclestage: LIFECYCLE_STAGE
  hs_lead_status: LEAD_STATUS
  company: COMPANY_NAME

  # Deal metrics
  hs_total_deal_value: DEAL_VALUE
  num_associated_deals: DEAL_COUNT

  # Custom properties
  preferred_channel: PREFERRED_CHANNEL
  customer_segment: SEGMENT
```

## API Endpoints

### CRM Objects

| เมธอด | Endpoint | คำอธิบาย |
| --- | --- | --- |
| `GET` | `/crm/v3/objects/contacts` | แสดงรายการผู้ติดต่อ |
| `POST` | `/crm/v3/objects/contacts` | สร้างผู้ติดต่อ |
| `PATCH` | `/crm/v3/objects/contacts/{id}` | อัปเดตผู้ติดต่อ |
| `GET` | `/crm/v3/objects/companies` | แสดงรายการบริษัท |
| `GET` | `/crm/v3/objects/deals` | แสดงรายการดีล |
| `POST` | `/crm/v3/objects/deals` | สร้างดีล |
| `GET` | `/crm/v3/objects/tickets` | แสดงรายการตั๋ว |

### Associations

| เมธอด | Endpoint | คำอธิบาย |
| --- | --- | --- |
| `GET` | `/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}` | ดู associations |
| `PUT` | `/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}/{toObjectId}` | สร้าง association |

### Engagements

| เมธอด | Endpoint | คำอธิบาย |
| --- | --- | --- |
| `GET` | `/crm/v3/objects/calls` | แสดงรายการการโทร |
| `GET` | `/crm/v3/objects/emails` | แสดงรายการการมีส่วนร่วมทางอีเมล |
| `GET` | `/crm/v3/objects/meetings` | แสดงรายการการประชุม |
| `GET` | `/crm/v3/objects/notes` | แสดงรายการบันทึก |
| `GET` | `/crm/v3/objects/tasks` | แสดงรายการงาน |

## เหตุการณ์

### เหตุการณ์ผู้ติดต่อ

| เหตุการณ์ | ทริกเกอร์ | กรณีใช้งาน |
| --- | --- | --- |
| `contact.creation` | สร้างผู้ติดต่อใหม่ | ทริกเกอร์โฟลว์ต้อนรับ |
| `contact.propertyChange` | อัปเดตคุณสมบัติผู้ติดต่อ | ซิงค์แอตทริบิวต์ |
| `contact.merge` | รวมผู้ติดต่อ | การจัดการรายการซ้ำ |
| `contact.deletion` | ลบผู้ติดต่อ | ล้างข้อมูลใน Brevo |

### เหตุการณ์ดีล

| เหตุการณ์ | ทริกเกอร์ | กรณีใช้งาน |
| --- | --- | --- |
| `deal.creation` | สร้างดีลใหม่ | การแจ้งเตือนฝ่ายขาย |
| `deal.propertyChange` | เปลี่ยนขั้นตอนดีล | ระบบอัตโนมัติไปป์ไลน์ |
| `deal.deletion` | ลบดีล | รายงานรายได้ |

### เหตุการณ์บริษัท

| เหตุการณ์ | ทริกเกอร์ | กรณีใช้งาน |
| --- | --- | --- |
| `company.creation` | เพิ่มบริษัทใหม่ | การตลาดตามบัญชี |
| `company.propertyChange` | อัปเดตข้อมูลบริษัท | ซิงค์ข้อมูลองค์กร |

## ตัวอย่างโค้ด

### เริ่มต้น Connector

```javascript
import { TajoClient } from '@tajo/sdk';

const tajo = new TajoClient({
  apiKey: process.env.TAJO_API_KEY,
  brevoApiKey: process.env.BREVO_API_KEY
});

// Connect HubSpot
await tajo.connectors.connect('hubspot', {
  accessToken: process.env.HUBSPOT_ACCESS_TOKEN
});
```

### รันการซิงค์ผู้ติดต่อ

```javascript
// Full bidirectional sync
await tajo.connectors.sync('hubspot', {
  type: 'full',
  resources: ['contacts', 'companies', 'deals'],
  direction: 'bidirectional',
  since: '2023-01-01'
});

// Check sync status
const status = await tajo.connectors.status('hubspot');
console.log(status);
// {
//   connected: true,
//   lastSync: '2024-01-15T10:30:00Z',
//   contactsSynced: 34200,
//   companiesSynced: 5100,
//   dealsSynced: 2340
// }
```

### จัดการเหตุการณ์ Webhook

```javascript
// Handle HubSpot webhook notifications
app.post('/webhooks/hubspot', async (req, res) => {
  const signature = req.get('X-HubSpot-Signature-v3');

  // Verify webhook signature
  if (!verifyHubSpotSignature(req.body, signature)) {
    return res.status(401).send('Unauthorized');
  }

  for (const event of req.body) {
    await tajo.connectors.handleWebhook('hubspot', {
      eventType: event.subscriptionType,
      objectId: event.objectId,
      propertyName: event.propertyName,
      propertyValue: event.propertyValue
    });
  }

  res.status(200).send('OK');
});
```

## ขีดจำกัดอัตรา

HubSpot ใช้ขีดจำกัดอัตราต่อ private app หรือ OAuth app:

| แผน | ขีดจำกัดอัตรา | ขีดจำกัด Burst |
| --- | --- | --- |
| Free/Starter | 100 คำขอ/10 วินาที | 150 คำขอ/10 วินาที |
| Professional | 150 คำขอ/10 วินาที | 200 คำขอ/10 วินาที |
| Enterprise | 200 คำขอ/10 วินาที | 250 คำขอ/10 วินาที |
| API add-on | 200 คำขอ/10 วินาที | 250 คำขอ/10 วินาที |

ขีดจำกัดเพิ่มเติม:

- **Search API**: 5 คำขอ/วินาทีต่อ app
- **การดำเนินการแบบ Batch**: 100 รายการต่อคำขอ batch
- **ขีดจำกัดรายวัน**: 500,000 คำขอ/วัน (OAuth apps)

การจัดการขีดจำกัดอัตรา

HubSpot ส่งคืนการตอบสนอง `429 Too Many Requests` เมื่อเกินขีดจำกัด ใช้ exponential backoff และตรวจสอบ headers `X-HubSpot-RateLimit-*`

## การแก้ไขปัญหา

### ปัญหาทั่วไป

| ปัญหา | สาเหตุ | วิธีแก้ |
| --- | --- | --- |
| 401 Unauthorized | Token หมดอายุหรือไม่ถูกต้อง | สร้าง private app token ใหม่หรือรีเฟรช OAuth token |
| ผู้ติดต่อไม่ซิงค์ | ไม่มีคุณสมบัติอีเมล | ผู้ติดต่อ HubSpot ต้องการอีเมลสำหรับการซิงค์ Brevo |
| ผู้ติดต่อซ้ำ | ไม่มีกฎการลบข้อมูลซ้ำ | กำหนดค่ากฎการรวมใน HubSpot |
| ไม่ได้รับ Webhook | การสมัครสมาชิกไม่ใช้งาน | ลงทะเบียนการสมัครสมาชิก webhook ใหม่ |
| คุณสมบัติไม่แมป | ไม่ได้สร้าง custom property | สร้างคุณสมบัติใน HubSpot ก่อน |

### โหมด Debug

เปิดใช้การบันทึกข้อมูลแบบละเอียด:

```yaml
connectors:
  hubspot:
    debug: true
    log_level: verbose
    log_webhooks: true
```

### ทดสอบการเชื่อมต่อ

```bash
tajo connectors test hubspot
# ✓ API connection successful
# ✓ Contacts readable
# ✓ Companies readable
# ✓ Deals readable
# ✓ Webhooks registered
```

## แนวทางปฏิบัติที่ดีที่สุด

1. **ใช้ private apps แทน API keys** - API keys เลิกใช้แล้ว ใช้ private apps เพื่อความปลอดภัยที่ดีกว่า
2. **ใช้การซิงค์สองทิศทางอย่างระมัดระวัง** - หลีกเลี่ยงลูปอนันต์โดยการติดตามแหล่งซิงค์
3. **แมปขั้นตอนวงจรชีวิต** - ใช้ขั้นตอนวงจรชีวิต HubSpot เพื่อแบ่งกลุ่มผู้ติดต่อใน Brevo
4. **ส่งคำขอ API เป็น Batch** - ใช้ batch endpoints สำหรับการดำเนินการจำนวนมากเพื่ออยู่ภายในขีดจำกัดอัตรา
5. **ตรวจสอบการส่ง webhook** - ตั้งค่าตรรกะการลองใหม่และการจัดการ dead letter
6. **ใช้การซิงค์แบบเพิ่มทีละน้อย** - ซิงค์เฉพาะบันทึกที่เปลี่ยนแปลงโดยใช้คุณสมบัติ `lastmodifieddate`

## ความปลอดภัย

- **Private App Tokens** - Access tokens แบบกำหนดขอบเขตพร้อมสิทธิ์แบบละเอียด
- **OAuth 2.0** - การอนุญาตตามมาตรฐานอุตสาหกรรมพร้อมการหมุนเวียน refresh token
- **ลายเซ็น Webhook** - การตรวจสอบลายเซ็นตาม HMAC (v3)
- **การเข้ารหัส TLS** - การสื่อสาร API ทั้งหมดเข้ารหัสระหว่างส่งผ่าน
- **สิทธิ์แบบกำหนดขอบเขต** - การเข้าถึง scope ขั้นต่ำที่จำเป็นต่อการผสานรวม

## แหล่งข้อมูลที่เกี่ยวข้อง

- [HubSpot API Documentation](https://developers.hubspot.com/docs/api/overview)
- [HubSpot Authentication Guide](https://developers.hubspot.com/docs/api/working-with-oauth)
- [Salesforce Connector](https://tajo.io/th/docs/connectors/crm/salesforce)
- [Customer Sync Skill](https://tajo.io/th/docs/skills/data-sync/customer-sync)
- [Brevo Contacts API](https://tajo.io/th/docs/contact-management)
