---
title: "Trình Kết Nối Klaviyo"
description: "Hướng dẫn tích hợp Klaviyo đầy đủ để đồng bộ profiles, events, lists, segments và campaign data với Brevo qua Tajo."
url: https://tajo.io/vi/docs/connectors/marketing/klaviyo/
markdown: https://tajo.io/vi/docs/connectors/marketing/klaviyo.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 Klaviyo

Trạng thái trình kết nối: Đang phát triển Đang xây dựng. Chưa được xác minh.

| 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 Klaviyo với Brevo qua Tajo để migration hoặc đồng bộ dữ liệu marketing giữa các nền tảng. Đồng bộ profiles, events, lists, segments, flows và campaign data cho chiến lược marketing đa kênh hợp nhất.

## Tổng Quan

| Thuộc Tính | Giá Trị |
| --- | --- |
| **Nền Tảng** | Klaviyo |
| **Danh Mục** | Marketing |
| **Độ 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ộ** | Profiles, Sự Kiện, Lists, Segments, Campaigns |
| **Skills Có Sẵn** | 10 |
| **Chuẩn API** | JSON:API |

## Tính Năng

- **Đồng bộ profile** - Đồng bộ hai chiều customer profiles giữa Klaviyo và Brevo
- **Forward sự kiện** - Forward Klaviyo tracked events sang Brevo để kích hoạt automation
- **Migration list** - Đồng bộ Klaviyo lists sang Brevo contact lists
- **Đồng bộ segment** - Xuất Klaviyo segments như Brevo lists hoặc segments
- **Xuất dữ liệu flow** - Kéo dữ liệu hiệu suất flow cho cross-platform analytics
- **Đồng bộ campaign** - Phối hợp campaigns qua kênh Klaviyo và Brevo
- **Đồng bộ catalog** - Sao chép product catalogs giữa các nền tảng
- **Quản lý coupon** - Đồng bộ mã coupon và dữ liệu sử dụng

## Yêu Cầu

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

1. Tài khoản Klaviyo với quyền truy cập API
2. Private API Key với phạm vi phù hợp
3. Public API Key Klaviyo của bạn (company ID 6 ký tự)
4. Tài khoản Brevo với quyền truy cập API
5. Tài khoản Tajo với API credentials

## Xác Thực

### Private API Key

Klaviyo sử dụng private API keys với scoped access cho server-side authentication. Đặt key trong header `Authorization`:

```bash
curl https://a.klaviyo.com/api/profiles/ \
  -H "Authorization: Klaviyo-API-Key your-private-api-key" \
  -H "revision: 2026-01-15"
```

### Phạm Vi API Key

Cấu hình phạm vi khi tạo private key:

| Phạm Vi | Quyền Truy Cập | Mô Tả |
| --- | --- | --- |
| `profiles` | Read/Full | Truy cập contact profiles |
| `events` | Read/Full | Truy cập tracked events |
| `lists` | Read/Full | Truy cập contact lists |
| `segments` | Read | Truy cập segments |
| `campaigns` | Read | Truy cập campaign data |
| `metrics` | Read | Truy cập metric definitions |
| `flows` | Read | Truy cập flow configurations |
| `catalogs` | Read | Truy cập product catalogs |

### Public API Key

Cho client-side tracking, sử dụng company ID 6 ký tự:

```bash
curl -X POST "https://a.klaviyo.com/client/events/?company_id=COMPANY_ID" \
  -H "Content-Type: application/json" \
  -d '{"data": {...}}'
```

### OAuth (Tích Hợp Partner)

Klaviyo hỗ trợ OAuth cho tech partners, cung cấp bảo mật và giới hạn tốc độ tốt hơn:

```bash
curl https://a.klaviyo.com/api/profiles/ \
  -H "Authorization: Bearer YOUR_OAUTH_TOKEN" \
  -H "revision: 2026-01-15"
```

## Cấu Hình

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

```yaml
connectors:
  klaviyo:
    enabled: true
    private_api_key: "your-klaviyo-private-key"
    public_api_key: "XXXXXX"
    api_revision: "2026-01-15"

    # Tùy chọn đồng bộ dữ liệu
    sync:
      profiles: true
      events: true
      lists: true
      segments: true
      catalogs: false

    # Gán danh sách Brevo
    lists:
      all_contacts: 20
      subscribers: 21
      high_value: 22
```

### Ánh Xạ Profile

Ánh xạ Klaviyo profile properties sang thuộc tính liên hệ Brevo:

```yaml
profile_mapping:
  email: email
  first_name: FIRSTNAME
  last_name: LASTNAME
  phone_number: SMS
  city: CITY
  region: REGION
  country: COUNTRY
  zip: ZIP
  organization: COMPANY
  title: JOB_TITLE

  # Thuộc tính tùy chỉnh
  lifetime_value: LTV
  total_orders: ORDER_COUNT
  last_order_date: LAST_ORDER_DATE
  preferred_channel: CHANNEL_PREF
```

### Ánh Xạ Sự Kiện

Ánh xạ Klaviyo metrics sang Brevo events:

```yaml
event_mapping:
  "Placed Order": "order_completed"
  "Ordered Product": "product_purchased"
  "Started Checkout": "checkout_started"
  "Added to Cart": "cart_updated"
  "Viewed Product": "product_viewed"
  "Subscribed to List": "customer_subscribed"
  "Received Email": "email_received"
  "Opened Email": "email_opened"
  "Clicked Email": "email_clicked"
```

## API Endpoints

| Phương Thức | Endpoint | Mô Tả |
| --- | --- | --- |
| `GET` | `/api/profiles/` | Liệt kê profiles |
| `POST` | `/api/profiles/` | Tạo profile |
| `PATCH` | `/api/profiles/{id}/` | Cập nhật profile |
| `POST` | `/api/profile-merge/` | Merge profiles trùng lặp |
| `GET` | `/api/events/` | Liệt kê events |
| `POST` | `/api/events/` | Tạo event |
| `GET` | `/api/lists/` | Liệt kê tất cả lists |
| `POST` | `/api/lists/{id}/relationships/profiles/` | Thêm profiles vào list |
| `GET` | `/api/segments/` | Liệt kê segments |
| `GET` | `/api/campaigns/` | Liệt kê campaigns |
| `GET` | `/api/flows/` | Liệt kê flows |
| `GET` | `/api/metrics/` | Liệt kê metrics |
| `POST` | `/api/metric-aggregates/` | Truy vấn metric aggregates |
| `GET` | `/api/catalog-items/` | Liệt kê catalog items |

## Ví Dụ Code

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

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

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

// Kết nối tài khoản Klaviyo
await tajo.connectors.connect('klaviyo', {
  privateApiKey: process.env.KLAVIYO_PRIVATE_KEY,
  publicApiKey: process.env.KLAVIYO_PUBLIC_KEY
});
```

### Đồng Bộ Profiles Sang Brevo

```javascript
// Lấy Klaviyo profiles và đồng bộ sang Brevo
const response = await fetch('https://a.klaviyo.com/api/profiles/', {
  headers: {
    'Authorization': `Klaviyo-API-Key ${PRIVATE_KEY}`,
    'revision': '2026-01-15',
    'Accept': 'application/vnd.api+json'
  }
});

const { data } = await response.json();

// Mỗi profile theo định dạng JSON:API
// {
//   "type": "profile",
//   "id": "01ABCDEF",
//   "attributes": {
//     "email": "jane@example.com",
//     "first_name": "Jane",
//     "last_name": "Kim",
//     "phone_number": "+15551234567",
//     "properties": { "lifetime_value": 450.00 }
//   }
// }
```

### Tạo Event

```javascript
// Track event trong Klaviyo (được forward sang Brevo qua Tajo)
await fetch('https://a.klaviyo.com/api/events/', {
  method: 'POST',
  headers: {
    'Authorization': `Klaviyo-API-Key ${PRIVATE_KEY}`,
    'revision': '2026-01-15',
    'Content-Type': 'application/vnd.api+json',
    'Accept': 'application/vnd.api+json'
  },
  body: JSON.stringify({
    data: {
      type: 'event',
      attributes: {
        metric: {
          data: { type: 'metric', attributes: { name: 'Placed Order' } }
        },
        profile: {
          data: { type: 'profile', attributes: { email: 'jane@example.com' } }
        },
        properties: {
          OrderId: 'ORD-1234',
          Value: 89.99,
          Items: [
            { ProductName: 'Widget Pro', Price: 89.99, Quantity: 1 }
          ]
        },
        value: 89.99
      }
    }
  })
});
```

### Truy Vấn Metric Aggregates

```javascript
// Lấy dữ liệu metric tổng hợp cho báo cáo
await fetch('https://a.klaviyo.com/api/metric-aggregates/', {
  method: 'POST',
  headers: {
    'Authorization': `Klaviyo-API-Key ${PRIVATE_KEY}`,
    'revision': '2026-01-15',
    'Content-Type': 'application/vnd.api+json'
  },
  body: JSON.stringify({
    data: {
      type: 'metric-aggregate',
      attributes: {
        metric_id: 'METRIC_ID',
        measurements: ['count', 'sum_value'],
        interval: 'day',
        filter: ['greater-or-equal(datetime,2024-01-01)',
                 'less-than(datetime,2024-02-01)']
      }
    }
  })
});
```

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

| Xác Thực | Giới Hạn Burst | Giới Hạn Ổn Định |
| --- | --- | --- |
| **Private API Key** | 75 yêu cầu/giây | 700 yêu cầu/phút |
| **OAuth** | 150 yêu cầu/giây | 1.500 yêu cầu/phút |
| **Client API** | 100 yêu cầu/giây | N/A |
| **Bulk operations** | 10 yêu cầu/giây | 100 yêu cầu/phút |

Yêu Cầu API Revision

Tất cả Klaviyo API requests yêu cầu header `revision` được đặt thành ngày API version hợp lệ (ví dụ: `2026-01-15`). Requests không có header này sẽ bị từ chối.

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

| Sự Cố | Nguyên Nhân | Giải Pháp |
| --- | --- | --- |
| `400 Bad Request` | API key không hợp lệ hoặc thiếu | Xác minh private API key chính xác |
| `403 Forbidden` | Phạm vi không đủ | Kiểm tra phạm vi API key khớp quyền cần thiết |
| Thiếu header `revision` | Header chưa đặt | Thêm `revision: 2026-01-15` vào tất cả requests |
| Profile không tìm thấy | Định danh sai | Dùng Klaviyo profile ID, không phải email để lookup |
| Events không đồng bộ | Tên metric sai | Khớp chính xác tên metric như định nghĩa trong Klaviyo |
| `429 Too Many Requests` | Vượt giới hạn tốc độ | Triển khai exponential backoff, cân nhắc OAuth để có giới hạn cao hơn |
| Lỗi định dạng JSON:API | Content type sai | Dùng `application/vnd.api+json` cho Content-Type và Accept headers |

## Thực Hành Tốt Nhất

1. **Sử dụng định dạng JSON:API** - Tuân theo JSON:API specification cho tất cả request và response payloads
2. **Đặt revision header** - Luôn bao gồm header `revision` với ngày API version mới nhất
3. **Sử dụng sparse fieldsets** - Chỉ yêu cầu các trường cần thiết với `?fields[profile]=email,first_name` để giảm kích thước payload
4. **Tận dụng relationships** - Sử dụng tham số `include` của JSON:API để lấy related resources trong một request
5. **Sử dụng cursor pagination** - Điều hướng qua tập kết quả lớn với tham số `page[cursor]`
6. **Triển khai bulk operations** - Sử dụng bulk endpoints cho batch profile imports và event creation
7. **Dùng OAuth để có giới hạn cao hơn** - Xác thực OAuth cung cấp giới hạn tốc độ cao hơn 2x so với private keys

## Bảo Mật

- **Phạm vi private API key** - Kiểm soát Read/Full chi tiết mỗi loại tài nguyên
- **Hỗ trợ OAuth** - Xác thực dựa trên token an toàn cho tích hợp partner
- **Cô lập public key** - Client-side keys chỉ giới hạn thao tác create
- **TLS 1.2+** - Tất cả giao tiếp API được mã hóa trong quá trình truyền
- **SOC 2 Type II** - Klaviyo được chứng nhận SOC 2 Type II
- **Tuân thủ GDPR** - Data Privacy API cho yêu cầu xóa profile

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

- [Trình Kết Nối Brevo](https://tajo.io/vi/docs/connectors/marketing/brevo)
- [Trình Kết Nối Google Ads](https://tajo.io/vi/docs/connectors/marketing/google-ads)
- [Trình Kết Nối Meta Ads](https://tajo.io/vi/docs/connectors/marketing/meta-ads)
- [Customer Sync Skill](https://tajo.io/vi/docs/skills/data-sync/customer-sync)
