Custom API + Brevo Integration
Custom API + Brevo Integration
ใช้ Tajo custom API connector เพื่อเชื่อมต่อแพลตฟอร์มใดก็ตามกับ Brevo, internal systems, legacy applications หรือ REST API ใดก็ตามที่ให้ข้อมูลลูกค้า
เมื่อใดควรใช้ Custom API Connector
- แพลตฟอร์มของคุณไม่มี Tajo integration ในตัว
- คุณมี internal CRM หรือ ERP system
- คุณต้องการ custom data transformation logic
- คุณทำงานกับ legacy system ที่ expose REST หรือ webhook API
ขั้นตอนที่ 1: กำหนด Data Schema
interface PlatformCustomer { user_id: string; user_email: string; full_name: string; mobile_number?: string; subscription_plan: "free" | "pro" | "enterprise"; lifetime_value: number;}ขั้นตอนที่ 2: สร้าง Connector
import { TajoConnector } from "@tajo/connector-sdk";
const connector = new TajoConnector({ name: "my-platform-brevo", brevoApiKey: process.env.BREVO_API_KEY,});
connector.defineMapping("customer", (platformCustomer: PlatformCustomer) => ({ email: platformCustomer.user_email, attributes: { FIRSTNAME: platformCustomer.full_name.split(" ")[0], LASTNAME: platformCustomer.full_name.split(" ").slice(1).join(" "), SMS: platformCustomer.mobile_number, SUBSCRIPTION_PLAN: platformCustomer.subscription_plan, LIFETIME_VALUE: platformCustomer.lifetime_value, },}));ขั้นตอนที่ 3: รับ Webhook Events
app.post("/webhooks/platform", async (req, res) => { const event = req.body;
switch (event.type) { case "user.created": await connector.syncCustomer(event.data); break; case "purchase.completed": await connector.trackEvent({ email: event.data.user_email, event: "purchase", properties: { amount: event.data.amount }, }); break; }
res.json({ received: true });});ขั้นตอนถัดไป
- Brevo MCP Server, Brevo tools ที่มี
- สร้างเอเจนต์, AI agents สำหรับ custom integrations