Trình Kết Nối Klaviyo

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ínhGiá Trị
Nền TảngKlaviyo
Danh MụcMarketing
Độ Phức Tạp Thiết LậpTrung Bình
Tích Hợp Chính ThứcKhông
Dữ Liệu Đồng BộProfiles, Sự Kiện, Lists, Segments, Campaigns
Skills Có Sẵn10
Chuẩn APIJSON: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:

Terminal window
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 ViQuyền Truy CậpMô Tả
profilesRead/FullTruy cập contact profiles
eventsRead/FullTruy cập tracked events
listsRead/FullTruy cập contact lists
segmentsReadTruy cập segments
campaignsReadTruy cập campaign data
metricsReadTruy cập metric definitions
flowsReadTruy cập flow configurations
catalogsReadTruy cập product catalogs

Public API Key

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

Terminal window
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:

Terminal window
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

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:

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:

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ứcEndpointMô 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

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

// 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": "[email protected]",
// "first_name": "Jane",
// "last_name": "Kim",
// "phone_number": "+15551234567",
// "properties": { "lifetime_value": 450.00 }
// }
// }

Tạo Event

// 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: '[email protected]' } }
},
properties: {
OrderId: 'ORD-1234',
Value: 89.99,
Items: [
{ ProductName: 'Widget Pro', Price: 89.99, Quantity: 1 }
]
},
value: 89.99
}
}
})
});

Truy Vấn Metric Aggregates

// 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ựcGiới Hạn BurstGiới Hạn Ổn Định
Private API Key75 yêu cầu/giây700 yêu cầu/phút
OAuth150 yêu cầu/giây1.500 yêu cầu/phút
Client API100 yêu cầu/giâyN/A
Bulk operations10 yêu cầu/giây100 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ânGiải Pháp
400 Bad RequestAPI key không hợp lệ hoặc thiếuXác minh private API key chính xác
403 ForbiddenPhạm vi không đủKiểm tra phạm vi API key khớp quyền cần thiết
Thiếu header revisionHeader chưa đặtThêm revision: 2026-01-15 vào tất cả requests
Profile không tìm thấyĐịnh danh saiDùng Klaviyo profile ID, không phải email để lookup
Events không đồng bộTên metric saiKhớp chính xác tên metric như định nghĩa trong Klaviyo
429 Too Many RequestsVượ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:APIContent type saiDù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

Subscribe to updates

developer-docs

Drop your email or phone number — we'll send you what matters next.

auto-detect
Trợ lý AI

Xin chào! Hãy hỏi tôi về tài liệu.