BigCommerce Connector
BigCommerce Connector
เชื่อมต่อร้านค้า BigCommerce ของคุณกับ Brevo ผ่าน Tajo เพื่อการซิงค์ข้อมูล e-commerce ที่สมบูรณ์ ซิงค์ลูกค้า คำสั่งซื้อ สินค้า และเหตุการณ์ cart เพื่อขับเคลื่อนแคมเปญการตลาดที่กำหนดเป้าหมาย การกู้คืน cart ที่ถูกละทิ้ง และระบบอัตโนมัติหลังการซื้อ
ภาพรวม
| คุณสมบัติ | ค่า |
|---|---|
| แพลตฟอร์ม | BigCommerce |
| หมวดหมู่ | E-commerce |
| ความซับซ้อนในการตั้งค่า | ปานกลาง |
| การผสานรวมอย่างเป็นทางการ | ไม่ |
| ข้อมูลที่ซิงค์ | ลูกค้า คำสั่งซื้อ สินค้า Carts |
| ทักษะที่ใช้ได้ | 10 |
ฟีเจอร์
- การซิงค์ลูกค้า - การซิงค์ข้อมูลลูกค้าแบบเรียลไทม์กับผู้ติดต่อ Brevo
- การติดตามคำสั่งซื้อ - เหตุการณ์ lifecycle ของคำสั่งซื้อสำหรับเวิร์กโฟลว์การตลาดหลังการซื้อ
- การซิงค์แคตาล็อกสินค้า - ซิงค์สินค้าสำหรับคำแนะนำในอีเมลและเนื้อหาแบบ dynamic
- การละทิ้ง cart - ติดตามและกู้คืน cart ที่ถูกละทิ้งด้วยอีเมลอัตโนมัติ
- รองรับหลาย storefront - เชื่อมต่อหลาย BigCommerce storefronts
- การอัปเดตที่ขับเคลื่อนด้วย webhook - การอัปเดตข้อมูลแบบเรียลไทม์ผ่าน BigCommerce webhooks
- ฟิลด์กำหนดเอง - แมป BigCommerce custom fields กับแอตทริบิวต์ผู้ติดต่อ Brevo
- การติดตาม inventory - ซิงค์ระดับสต็อกสำหรับการแจ้งเตือนเมื่อสินค้ากลับมาในสต็อก
ข้อกำหนดเบื้องต้น
ก่อนเริ่มต้น ตรวจสอบให้แน่ใจว่าคุณมี:
- ร้านค้า BigCommerce ที่มีสิทธิ์ Store Owner หรือ Admin
- บัญชี BigCommerce API ที่มี OAuth scopes ที่เหมาะสม
- Store Hash ของคุณ (พบได้ใน URL ร้านค้าหรือข้อมูลประจำตัว API)
- บัญชี Brevo ที่มีสิทธิ์เข้าถึง API
- บัญชี Tajo ที่มีข้อมูลประจำตัว API
การยืนยันตัวตน
ข้อมูลประจำตัวบัญชี API
BigCommerce ใช้บัญชี API ที่ใช้ OAuth สร้างบัญชีในแผงควบคุม BigCommerce ของคุณภายใต้ Settings > API > API Accounts
คุณจะได้รับ:
- Client ID - ตัวระบุแอปของคุณ
- Client Secret - Secret ของแอปคุณ (เก็บอย่างปลอดภัย)
- Access Token - ใช้สำหรับการยืนยันตัวตน API
- Store Hash - ตัวระบุ store ที่ไม่ซ้ำกันของคุณ
curl https://api.bigcommerce.com/stores/{store_hash}/v3/catalog/products \ -H "X-Auth-Token: YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "Accept: application/json"OAuth Scopes ที่จำเป็น
| Scope | การเข้าถึง | จุดประสงค์ |
|---|---|---|
store_v2_customers | อ่าน | การซิงค์ข้อมูลลูกค้า |
store_v2_orders | อ่าน | การติดตามเหตุการณ์คำสั่งซื้อ |
store_v2_products | อ่าน | การซิงค์แคตาล็อกสินค้า |
store_cart | อ่าน | การติดตาม cart ที่ถูกละทิ้ง |
store_v2_information | อ่าน | การกำหนดค่า store |
store_v2_content | อ่าน | เนื้อหา storefront |
การกำหนดค่า
การตั้งค่าพื้นฐาน
connectors: bigcommerce: enabled: true store_hash: "your-store-hash" access_token: "your-access-token" client_id: "your-client-id"
# Data sync options sync: customers: true orders: true products: true carts: true inventory: false
# Brevo list assignment lists: all_customers: 40 buyers: 41 abandoned_cart: 42การแมปฟิลด์ลูกค้า
แมปฟิลด์ลูกค้า BigCommerce กับแอตทริบิวต์ Brevo:
customer_mapping: email: email first_name: FIRSTNAME last_name: LASTNAME phone: SMS company: COMPANY
# Address fields addresses[0].city: CITY addresses[0].state: STATE addresses[0].country: COUNTRY addresses[0].zip: ZIP
# E-commerce metrics orders_count: ORDER_COUNT total_spent: TOTAL_SPENT date_created: SIGNUP_DATE
# Customer group customer_group_id: CUSTOMER_GROUPการกำหนดค่า Webhook
webhooks: - scope: "store/customer/created" destination: "customer_created" - scope: "store/customer/updated" destination: "customer_updated" - scope: "store/order/created" destination: "order_placed" - scope: "store/order/updated" destination: "order_updated" - scope: "store/order/statusUpdated" destination: "order_status_changed" - scope: "store/cart/created" destination: "cart_created" - scope: "store/cart/updated" destination: "cart_updated" - scope: "store/cart/abandoned" destination: "cart_abandoned" - scope: "store/inventory/updated" destination: "inventory_changed"API Endpoints
| เมธอด | Endpoint | คำอธิบาย |
|---|---|---|
GET | /v3/customers | แสดงรายการลูกค้า |
POST | /v3/customers | สร้างลูกค้า |
PUT | /v3/customers | อัปเดตลูกค้า |
GET | /v2/orders | แสดงรายการคำสั่งซื้อ |
GET | /v2/orders/{id} | ดูรายละเอียดคำสั่งซื้อ |
GET | /v3/catalog/products | แสดงรายการสินค้า |
GET | /v3/catalog/products/{id} | ดูรายละเอียดสินค้า |
GET | /v3/catalog/products/{id}/variants | แสดงรายการ variants ของสินค้า |
GET | /v3/carts | แสดงรายการ carts |
GET | /v3/abandoned-carts | แสดงรายการ carts ที่ถูกละทิ้ง |
POST | /v3/hooks | สร้าง webhook |
GET | /v3/catalog/categories | แสดงรายการหมวดหมู่ |
ตัวอย่างโค้ด
เริ่มต้น BigCommerce Connector
import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({ apiKey: process.env.TAJO_API_KEY, brevoApiKey: process.env.BREVO_API_KEY});
// Connect BigCommerce storeawait tajo.connectors.connect('bigcommerce', { storeHash: process.env.BC_STORE_HASH, accessToken: process.env.BC_ACCESS_TOKEN, clientId: process.env.BC_CLIENT_ID});ดึงและซิงค์ลูกค้า
// Fetch customers from BigCommerceconst response = await fetch( `https://api.bigcommerce.com/stores/${STORE_HASH}/v3/customers?limit=250`, { headers: { 'X-Auth-Token': ACCESS_TOKEN, 'Content-Type': 'application/json' } });
const { data, meta } = await response.json();// data: [{ id, email, first_name, last_name, phone, ... }]// meta.pagination: { total, count, per_page, current_page, total_pages }จัดการเหตุการณ์ Webhook
// BigCommerce webhook handlerapp.post('/webhooks/bigcommerce', async (req, res) => { const { scope, store_id, data } = req.body;
// Verify the webhook is from your store if (store_id !== process.env.BC_STORE_HASH) { return res.status(401).send('Unauthorized'); }
// Forward to Tajo await tajo.connectors.handleWebhook('bigcommerce', { topic: scope, payload: data });
res.status(200).send('OK');});ซิงค์แคตาล็อกสินค้า
// Full product catalog syncawait tajo.connectors.sync('bigcommerce', { type: 'full', resources: ['products'], includeVariants: true, includeImages: true});
// Check sync statusconst status = await tajo.connectors.status('bigcommerce');console.log(status);// {// connected: true,// lastSync: '2024-01-15T10:30:00Z',// customersCount: 8200,// ordersCount: 4500,// productsCount: 620// }ขีดจำกัดอัตรา
| แผน | ขีดจำกัด | รายละเอียด |
|---|---|---|
| Standard | 150 คำขอ/30 วินาที | ต่อ store |
| Plus | 300 คำขอ/30 วินาที | ต่อ store |
| Pro | 450 คำขอ/30 วินาที | ต่อ store |
| Enterprise | ไม่จำกัด | ขีดจำกัดกำหนดเอง |
ขีดจำกัดเพิ่มเติม:
| ทรัพยากร | ขีดจำกัด |
|---|---|
| Webhooks | 100 ต่อ store |
| ต่อหน้า | สูงสุด 250 records |
| คำขอพร้อมกัน | ขึ้นอยู่กับแผน |
Rate Limit Headers
ตรวจสอบ headers X-Rate-Limit-Requests-Left และ X-Rate-Limit-Time-Reset-Ms เพื่อจัดการการใช้งาน API ของคุณภายในขีดจำกัด
การแก้ไขปัญหา
| ปัญหา | สาเหตุ | วิธีแก้ |
|---|---|---|
401 Unauthorized | Access token ไม่ถูกต้อง | สร้างข้อมูลประจำตัว API ใหม่ใน BigCommerce admin |
403 Forbidden | ขาด OAuth scope | ตรวจสอบ scopes ของบัญชี API และเพิ่มสิทธิ์ที่จำเป็น |
| Webhooks ไม่ทำงาน | ถึงขีดจำกัด webhook | ตรวจสอบจำนวน webhook (สูงสุด 100) และลบอันที่ไม่ใช้ |
| เหตุการณ์ cart หายไป | Script ไม่ได้โหลด | ตรวจสอบ tracking script บน BigCommerce storefront |
| สินค้าไม่ sync | แคตาล็อก cache | ทริกเกอร์การซิงค์ manual หรือรอการอัปเดต webhook |
429 Too Many Requests | เกินขีดจำกัดอัตรา | ใช้ request queuing พร้อมการตรวจสอบ rate limit header |
| Customer groups หายไป | V2 vs V3 API | Customer groups ใช้ V2 API ตรวจสอบเวอร์ชัน endpoint |
แนวทางปฏิบัติที่ดีที่สุด
- ใช้ V3 API เมื่อเป็นไปได้ - V3 API มี pagination filtering และ JSON responses ที่ดีกว่า
- ตรวจสอบ rate limit headers - ติดตาม
X-Rate-Limit-Requests-Leftเพื่อหลีกเลี่ยงการถึงขีดจำกัด - ลงทะเบียน webhooks สำหรับ real-time sync - ใช้ webhooks แทนการ polling สำหรับการอัปเดตลูกค้าและคำสั่งซื้อ
- Batch การอัปเดตลูกค้า - ใช้ V3 bulk customer endpoints สำหรับการซิงค์ข้อมูลขนาดใหญ่
- รวม variants ในการซิงค์สินค้า - ซิงค์ product variants สำหรับการติดตาม inventory ที่แม่นยำ
- ตั้งค่า abandoned cart webhooks - สำคัญมากสำหรับระบบอัตโนมัติอีเมลกู้คืน cart
- ใช้ pagination - แบ่งหน้า list endpoints เสมอ สูงสุด 250 records ต่อหน้า
ความปลอดภัย
- การยืนยันตัวตนด้วย OAuth token - การเข้าถึง API แบบ secure token
- สิทธิ์ที่กำหนดขอบเขต - บัญชี API จำกัดเฉพาะ data scopes ที่เฉพาะเจาะจง
- HTTPS เท่านั้น - การสื่อสาร API ทั้งหมดเข้ารหัสผ่าน TLS
- การตรวจสอบ webhook - ตรวจสอบแหล่งที่มา webhook โดยใช้ store hash
- สอดคล้องกับ PCI DSS - BigCommerce จัดการข้อมูลการชำระเงินอย่างปลอดภัย
- SOC 2 Type II - แพลตฟอร์ม BigCommerce ได้รับการรับรอง SOC 2