---
title: "Trình Kết Nối Segment"
description: "Hướng dẫn tích hợp Twilio Segment đầy đủ để đồng bộ customer data, events và identities với Brevo qua Tajo."
url: https://tajo.io/vi/docs/connectors/custom/segment/
markdown: https://tajo.io/vi/docs/connectors/custom/segment.md
lang: vi-VN
robots: noindex
---

Đăng ký quyền truy cập sớm

Nhập tên và địa chỉ email công việc của bạn. Chúng tôi sẽ gửi liên kết để xác nhận yêu cầu truy cập Tajo.

# Trình Kết Nối Segment

Trạng thái trình kết nối: Dự kiến Chưa được xây dựng. Hiện Tajo chưa chạy trình kết nối này.

| Trường nguồn | Trường đích | Giá trị mẫu |
| --- | --- | --- |
| `record.id` | `source_id` | `record_1042` |
| `record.updated_at` | `updated_at` | `2026-10-18T08:00:00Z` |
| `record.value` | `value` | `sample_value` |

Kết nối Twilio Segment với Brevo qua Tajo để đồng bộ customer profiles hợp nhất, forward events từ hơn 400 nguồn và sử dụng Segment như CDP trung tâm cho tích hợp Brevo.

## Tổng Quan

| Thuộc Tính | Giá Trị |
| --- | --- |
| **Nền Tảng** | Twilio Segment |
| **Danh Mục** | Tùy Chỉnh |
| **Độ Phức Tạp Thiết Lập** | Trung Bình |
| **Tích Hợp Chính Thức** | Không |
| **Dữ Liệu Đồng Bộ** | Customers, Events, Traits |
| **Loại API** | Config API + Tracking API |
| **Xác Thực** | Workspace Token |

## Tính Năng

- **Đồng bộ profile hợp nhất** - Nhập customer profiles đã merge sang liên hệ Brevo
- **Forward sự kiện** - Stream sự kiện từ tất cả nguồn Segment sang Brevo triggers
- **Đồng bộ traits** - Ánh xạ Segment traits sang thuộc tính liên hệ Brevo
- **Identity resolution** - Sử dụng identity graph Segment để deduplicate liên hệ
- **Audiences** - Đồng bộ Segment Audiences sang danh sách Brevo
- **Profiles API** - Truy vấn profiles Segment theo thời gian thực

## Yêu Cầu

Trước khi bắt đầu, hãy đảm bảo bạn có:

1. Tài khoản Segment (Team hoặc Business)
2. Workspace Access Token
3. Tài khoản Brevo với quyền truy cập API
4. Tài khoản Tajo

## Xác Thực

### Workspace Token

```bash
curl "https://platform.segmentapis.com/v1beta/workspaces" \
  -H "Authorization: Bearer YOUR_WORKSPACE_TOKEN"
```

Tạo Access Tokens trong Segment Workspace Settings > Access Management.

### Kết Nối với Tajo

```bash
tajo connectors install segment \
  --workspace-token $SEGMENT_WORKSPACE_TOKEN \
  --workspace-slug $SEGMENT_WORKSPACE_SLUG
```

## Cấu Hình

### Thiết Lập Cơ Bản

```yaml
connectors:
  segment:
    enabled: true
    workspace_token: "${SEGMENT_WORKSPACE_TOKEN}"
    workspace_slug: "${SEGMENT_WORKSPACE_SLUG}"

    sync:
      profiles: true
      audiences: true
      events: false  # Dùng Segment Destination thay thế

    audience_mapping:
      "High Intent Users": 45
      "Trial Users": 46
      "Churned": 47
```

### Ánh Xạ Trường

```yaml
field_mapping:
  email: email
  traits.firstName: FIRSTNAME
  traits.lastName: LASTNAME
  traits.phone: SMS
  traits.company.name: COMPANY_NAME
  traits.plan: PLAN_TYPE
  traits.createdAt: SIGNUP_DATE
  traits.ltv: LIFETIME_VALUE
```

## API Endpoints

| Phương Thức | Endpoint | Mô Tả |
| --- | --- | --- |
| `GET` | `/v1/spaces/{id}/collections/users/profiles` | Liệt kê user profiles |
| `GET` | `/v1/spaces/{id}/collections/users/profiles/{id}` | Lấy profile cụ thể |
| `GET` | `/v1/spaces/{id}/collections/users/profiles/{id}/events` | Sự kiện của profile |
| `GET` | `/v1/spaces/{id}/collections/users/profiles/{id}/traits` | Traits của profile |
| `POST` | `/v1/tracking/send` | Gửi events sang Segment |

## Ví Dụ Code

### Khởi Tạo Trình Kết Nối

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

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

await tajo.connectors.connect('segment', {
  workspaceToken: process.env.SEGMENT_WORKSPACE_TOKEN,
  workspaceSlug: process.env.SEGMENT_WORKSPACE_SLUG
});
```

### Đồng Bộ Profiles Sang Brevo

```javascript
// Đồng bộ Segment profiles sang liên hệ Brevo
await tajo.connectors.sync('segment', {
  type: 'incremental',
  resources: ['profiles'],
  since: '2024-01-01',
  includeTraits: true
});
```

Giới Hạn Kích Thước Batch

Profiles API trả về tối đa 100 profiles mỗi trang. Đối với workspace có nhiều triệu users, hãy sử dụng Segment Sync thay vì Profile API để xuất bulk.

## Giới Hạn Tốc Độ

| Endpoint | Giới Hạn |
| --- | --- |
| Profiles API | 100 yêu cầu/giây |
| Config API | 60 yêu cầu/phút |
| Tracking API | Không giới hạn |

## Khắc Phục Sự Cố

| Sự Cố | Nguyên Nhân | Giải Pháp |
| --- | --- | --- |
| 403 Forbidden | Quyền không đủ | Thêm đúng scopes vào workspace token |
| Profiles thiếu | Space ID không đúng | Xác minh space ID trong Segment Profiles settings |
| Traits rỗng | Schema chưa được tạo | Đợi traits đầu tiên được nhận vào Segment |

## Tài Nguyên Liên Quan

- [Tài Liệu API Segment](https://segment.com/docs/api/)
- [Segment Profiles API](https://segment.com/docs/unify/profile-api/)
- [Customer Sync Skill](https://tajo.io/vi/docs/skills/data-sync/customer-sync)
