Tích Hợp Custom API + Brevo
Custom API + Brevo
Không phải nền tảng nào cũng có máy chủ MCP. Với WooCommerce, BigCommerce, Magento, CRM độc quyền, hoặc bất kỳ hệ thống nào có REST API, hãy xây dựng tác nhân kết nối giúp cầu nối dữ liệu của bạn với Brevo.
Hai Cách Tiếp Cận
Cách 1: Máy Chủ MCP Cộng Đồng
Kiểm tra xem có máy chủ MCP cộng đồng nào cho nền tảng của bạn không:
| Nền tảng | MCP Cộng đồng | Trạng thái |
|---|---|---|
| WooCommerce | woocommerce-mcp-server | Cộng đồng duy trì |
| BigCommerce | Kiểm tra thư mục máy chủ MCP | Thay đổi |
| Magento | Kiểm tra thư mục máy chủ MCP | Thay đổi |
| Salesforce | Nhiều tùy chọn có sẵn | Cộng đồng tích cực |
| Zendesk | Có sẵn qua Composio/Zapier | Hoạt động |
Nếu có máy chủ cộng đồng, hãy sử dụng nó giống như máy chủ chính thức, thêm vào cấu hình Claude cùng Brevo MCP.
Cách 2: Tác Nhân Với Công Cụ HTTP
Đối với các nền tảng không có máy chủ MCP, hãy xây dựng tác nhân sử dụng khả năng HTTP tích hợp của Claude để gọi trực tiếp REST APIs, sau đó ghi vào Brevo qua MCP.
Xây Dựng Tác Nhân Kết Nối Tùy Chỉnh
Bước 1: Hiểu API Nguồn
Ghi lại các endpoint quan trọng mà tác nhân cần:
# Example: WooCommerce REST APIsource_api: base_url: "https://your-store.com/wp-json/wc/v3" auth: Basic (consumer_key:consumer_secret) endpoints: - GET /customers # List customers - GET /customers/{id} # Get customer details - GET /orders # List orders - GET /orders/{id} # Get order details - GET /products # List products - GET /coupons # List couponsBước 2: Định Nghĩa Tác Nhân
---name: woocommerce-brevo-syncdescription: Sync WooCommerce customers and orders to Brevoversion: 1.0.0temperature: 0.1tools: - brevo_contacts - brevo_attributes - brevo_lists - brevo_email_campaign_managementtriggers: - schedule: "0 */6 * * *" - webhook: /agents/woocommerce/sync method: POST---
# WooCommerce → Brevo Sync Agent
Connect WooCommerce store data to Brevo for engagement campaigns.
## Source API
- **Base URL**: https://your-store.com/wp-json/wc/v3- **Authentication**: Basic Auth with consumer key/secret- **Key endpoints**: /customers, /orders, /products
## Sync Strategy
### Customer Sync1. GET /customers?modified_after={last_sync_time}2. For each customer: - Map WooCommerce fields to Brevo attributes - Create or update Brevo contact - Add to appropriate list based on order history
### Order Event Sync1. GET /orders?after={last_sync_time}&status=completed2. For each order: - Track "order_completed" event in Brevo - Update contact attributes (order_count, total_spent) - Trigger post-purchase campaign if applicable
## Field Mapping
| WooCommerce | Brevo Attribute ||-------------|-----------------|| email | EMAIL || first_name | FIRSTNAME || last_name | LASTNAME || billing.phone | SMS || orders_count | ORDER_COUNT || total_spent | TOTAL_SPENT || date_created | CUSTOMER_SINCE || role | CUSTOMER_TYPE |
## API Call Pattern
For each sync operation, the agent should:1. Call WooCommerce REST API to fetch data2. Transform the response to Brevo's expected format3. Call Brevo MCP tools to create/update contacts4. Log sync results for monitoring
## Rules- Respect WooCommerce API rate limits (default: 25 req/10 seconds)- ONLY sync customers with valid email addresses- Implement incremental sync using modified_after parameter- Store last sync timestamp for next runBước 3: Cấu Hình Brevo MCP
Chỉ kết nối các module Brevo mà tác nhân cần:
{ "mcpServers": { "brevo_contacts": { "url": "https://mcp.brevo.com/v1/brevo_contacts/mcp", "headers": { "Authorization": "Bearer your-brevo-token" } }, "brevo_email": { "url": "https://mcp.brevo.com/v1/brevo_email_campaign_management/mcp", "headers": { "Authorization": "Bearer your-brevo-token" } }, "brevo_lists": { "url": "https://mcp.brevo.com/v1/brevo_lists/mcp", "headers": { "Authorization": "Bearer your-brevo-token" } } }}Bước 4: Chạy Tác Nhân
Bạn: "Đồng bộ tất cả khách hàng WooCommerce từ tuần trước sang Brevo và thêm khách hàng mới vào danh sách Welcome Series."
Claude: Tôi sẽ đồng bộ khách hàng WooCommerce với Brevo.
Đang lấy khách hàng được sửa đổi trong 7 ngày qua từ WooCommerce...[Thực hiện HTTP GET tới your-store.com/wp-json/wc/v3/customers?modified_after=...]
Tìm thấy 67 khách hàng. Đang đồng bộ với Brevo...[Dùng brevo_contacts để tạo/cập nhật liên hệ][Dùng brevo_lists để thêm 23 khách hàng mới vào "Welcome Series"]
Đồng bộ hoàn tất:- 67 khách hàng đã xử lý- 44 liên hệ hiện có đã cập nhật- 23 liên hệ mới đã tạo → đã thêm vào Welcome Series- 0 bỏ qua (tất cả đều có email hợp lệ)Mẫu: Bộ Kết Nối REST API Tổng Quát
Sử dụng mẫu này cho bất kỳ REST API nào:
---name: {platform}-brevo-connectordescription: Sync {platform} data to Brevo for engagementversion: 1.0.0temperature: 0.1tools: - brevo_contacts - brevo_attributes - brevo_liststriggers: - schedule: "0 */6 * * *"---
# {Platform} → Brevo Connector
## Source API Configuration- **Base URL**: {api_base_url}- **Auth**: {auth_method} ({details})- **Rate Limit**: {rate_limit}
## Data to Sync
### Contacts- Source endpoint: {endpoint}- Brevo mapping: {field_map}- Sync frequency: Every 6 hours- Incremental: Use modified_after / updated_since parameter
### Events- Source endpoint: {endpoint}- Brevo event name: {event_name}- Trigger: When {condition}
## Sync Logic1. Fetch changed records from source since last sync2. Transform to Brevo format3. Upsert contacts via brevo_contacts4. Track events for campaign triggers5. Log results and update sync cursor
## Error Handling- Retry failed API calls 3 times with exponential backoff- Skip individual records that fail validation- Report errors in sync summary- NEVER stop entire sync for single record failureKhi Nào Nên Xây Dựng Máy Chủ MCP Đầy Đủ
Nếu bạn thấy mình kết nối cùng một nền tảng nhiều lần, hãy xem xét xây dựng máy chủ MCP riêng:
| Chỉ Dùng Tác Nhân | Xây Dựng Máy Chủ MCP |
|---|---|
| Đồng bộ một lần hoặc không thường xuyên | Đồng bộ sản xuất hàng ngày |
| Tạo nguyên mẫu tích hợp | Chia sẻ trong nhóm/tổ chức |
| Thao tác đọc đơn giản | Thao tác phức tạp nhiều bước |
| Cần ít hơn 5 endpoint API | Cần phủ sóng API đầy đủ |
Để xây dựng máy chủ MCP tùy chỉnh, xem đặc tả MCP và Integration Builder của Tajo.
Các Bước Tiếp Theo
- Tổng Quan Lớp Tích Hợp, Tất cả các tích hợp có sẵn
- Shopify + Brevo, Ví dụ MCP chính thức
- Đặc tả tác nhân, Định dạng markdown cho tác nhân
- Máy chủ MCP Brevo, Các module Brevo có sẵn