ตัวเชื่อม Shopify
ตัวเชื่อม Shopify
เชื่อมต่อร้านค้า Shopify ของคุณกับ Brevo เพื่อซิงก์ข้อมูลลูกค้าแบบครบถ้วน กู้ตะกร้าที่ถูกทิ้ง และทำแคมเปญ marketing อัตโนมัติ
ภาพรวม
| คุณสมบัติ | ค่า |
|---|---|
| แพลตฟอร์ม | Shopify |
| หมวดหมู่ | อีคอมเมิร์ซ |
| ความซับซ้อนในการตั้งค่า | ง่าย |
| Official Integration | ใช่ |
| ข้อมูลที่ซิงก์ | ลูกค้า, คำสั่งซื้อ, สินค้า, ตะกร้า, อีเวนต์ |
| Skills ที่พร้อมใช้งาน | 12 |
ฟีเจอร์
- ซิงก์ลูกค้าแบบเรียลไทม์ - ข้อมูลลูกค้าถูกซิงก์ไปยัง contact ใน Brevo ทันที
- ติดตามคำสั่งซื้อ - อีเวนต์คำสั่งซื้อสำหรับโฟลว์หลังการขาย
- ซิงก์แคตาล็อกสินค้า - สินค้าพร้อมใช้สำหรับการแนะนำ
- ตะกร้าที่ถูกทิ้ง - ติดตามและกู้ตะกร้าที่ถูกทิ้ง
- พฤติกรรมการเรียกดู - ติดตามการดูหน้าและความสนใจในสินค้า
- รองรับหลายร้าน - เชื่อมต่อ Shopify ได้หลายร้าน
สิ่งที่ต้องเตรียม
ก่อนเริ่มต้น โปรดตรวจสอบให้แน่ใจว่าคุณมี:
- ร้านค้า Shopify พร้อมสิทธิ์ admin
- บัญชี Brevo ที่เข้าถึง API ได้
- บัญชี Tajo
การติดตั้ง
ตัวเลือกที่ 1: Shopify App Store (แนะนำ)
- เข้าเยี่ยมชม แอป Tajo บน Shopify App Store
- คลิก “Add app”
- ให้สิทธิ์ตามที่ร้องขอ
- เชื่อมต่อบัญชี Brevo ของคุณ
ตัวเลือกที่ 2: ติดตั้งด้วยตนเอง
ขั้นตอนที่ 1: สร้าง Shopify App
- ไปที่ Shopify admin → Settings → Apps and sales channels
- คลิก “Develop apps” → “Create an app”
- ตั้งชื่อว่า “Tajo Integration”
ขั้นตอนที่ 2: ตั้งค่า API Scopes
เปิดใช้งาน scope เหล่านี้:
read_customerswrite_customersread_ordersread_productsread_checkoutswrite_script_tagsขั้นตอนที่ 3: ติดตั้งแอป
# Using Tajo CLItajo connectors install shopify \ --shop-url your-store.myshopify.com \ --api-key $SHOPIFY_API_KEY \ --api-secret $SHOPIFY_API_SECRETขั้นตอนที่ 4: ตั้งค่า Webhook
Tajo จะลงทะเบียน webhook เหล่านี้โดยอัตโนมัติ:
| Webhook | วัตถุประสงค์ |
|---|---|
customers/create | ซิงก์ลูกค้าใหม่ |
customers/update | การเปลี่ยนแปลงข้อมูลลูกค้า |
customers/delete | การลบลูกค้า |
orders/create | อีเวนต์การสั่งซื้อ |
orders/updated | การเปลี่ยนสถานะคำสั่งซื้อ |
checkouts/create | มีการสร้างตะกร้า |
checkouts/update | มีการอัปเดตตะกร้า |
การตั้งค่า
การตั้งค่าพื้นฐาน
connectors: shopify: enabled: true shop_url: "your-store.myshopify.com" api_version: "2024-01"
# Data sync options sync: customers: true orders: true products: true carts: true inventory: false # Optional
# List assignment lists: all_customers: 5 buyers: 6 abandoned_cart: 7การจับคู่ฟิลด์
จับคู่ฟิลด์ Shopify กับ attribute ของ contact ใน Brevo:
การจับคู่เริ่มต้น
| Parameter | Type | Description |
|---|---|---|
email required | string | อีเมลลูกค้า (ตัวระบุที่ไม่ซ้ำกัน) |
first_name optional | string | จับคู่กับ attribute FIRSTNAME |
last_name optional | string | จับคู่กับ attribute LASTNAME |
phone optional | string | จับคู่กับ attribute SMS สำหรับ WhatsApp/SMS |
accepts_marketing optional | boolean | ควบคุมสถานะการสมัครรับข่าวสาร |
orders_count optional | integer | จำนวนคำสั่งซื้อทั้งหมด |
total_spent optional | number | มูลค่าลูกค้าตลอดชีวิต |
tags optional | array | แท็กลูกค้าจาก Shopify |
การจับคู่ attribute แบบกำหนดเอง
field_mapping: # Standard fields email: email first_name: FIRSTNAME last_name: LASTNAME phone: SMS
# E-commerce metrics orders_count: ORDER_COUNT total_spent: TOTAL_SPENT last_order_date: LAST_ORDER_DATE
# Custom fields customer_type: CUSTOMER_TYPE preferred_language: LANGUAGE loyalty_tier: VIP_TIER
# Computed fields average_order_value: AOV days_since_last_order: RECENCYการซิงก์สินค้า
ซิงก์สินค้าสำหรับการแนะนำในอีเมล:
sync: products: enabled: true include_variants: true include_images: true categories_as_tags: true
# Filter products filter: status: active exclude_tags: ["hidden", "wholesale-only"]การติดตามสต็อกสินค้า
เปิดใช้งานการซิงก์ระดับสต็อก:
sync: inventory: enabled: true low_stock_threshold: 10 out_of_stock_events: trueอีเวนต์
อีเวนต์ลูกค้า
| อีเวนต์ | ทริกเกอร์ | กรณีการใช้งาน |
|---|---|---|
customer_created | ลูกค้าใหม่สมัครสมาชิก | ซีรีส์ต้อนรับ |
customer_updated | แก้ไขโปรไฟล์ | ซิงก์ข้อมูล |
customer_tags_added | มีการกำหนดแท็ก | อัปเดตเซ็กเมนต์ |
อีเวนต์คำสั่งซื้อ
| อีเวนต์ | ทริกเกอร์ | กรณีการใช้งาน |
|---|---|---|
order_placed | Checkout เสร็จสมบูรณ์ | ยืนยันคำสั่งซื้อ |
order_fulfilled | จัดส่งคำสั่งซื้อ | แจ้งเตือนการจัดส่ง |
order_cancelled | ยกเลิกคำสั่งซื้อ | อีเมลแจ้งยกเลิก |
order_refunded | ประมวลผลการคืนเงิน | ยืนยันการคืนเงิน |
อีเวนต์ตะกร้า
| อีเวนต์ | ทริกเกอร์ | กรณีการใช้งาน |
|---|---|---|
cart_created | เพิ่มสินค้าในตะกร้า | ติดตามการเรียกดู |
cart_updated | แก้ไขตะกร้า | ติดตามมูลค่าตะกร้า |
cart_abandoned | ไม่ checkout ภายใน 30 นาที | อีเมลกู้ตะกร้า |
Skills ที่เปิดใช้งาน
ตัวเชื่อม Shopify เปิดใช้งาน skill เหล่านี้:
| Skill | คำอธิบาย |
|---|---|
| Customer Sync | ซิงก์ลูกค้าแบบเรียลไทม์ |
| Order Events | ติดตามวงจรคำสั่งซื้อ |
| Abandoned Cart | อีเมลกู้ตะกร้า |
| Welcome Series | ต้อนรับลูกค้าใหม่ |
| Post-Purchase | ติดตามหลังคำสั่งซื้อ |
| Win-Back | ดึงลูกค้าที่ไม่ active กลับมา |
| Browse Abandonment | ติดตามความสนใจสินค้า |
| Replenishment | เตือนการสั่งซื้อซ้ำ |
ตัวอย่างโค้ด
เริ่มต้นใช้งานตัวเชื่อม
import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({ apiKey: process.env.TAJO_API_KEY, brevoApiKey: process.env.BREVO_API_KEY});
// Connect Shopify storeawait tajo.connectors.connect('shopify', { shopUrl: 'your-store.myshopify.com', apiKey: process.env.SHOPIFY_API_KEY, apiSecret: process.env.SHOPIFY_API_SECRET});รันการซิงก์ครั้งแรก
// Full historical syncawait tajo.connectors.sync('shopify', { type: 'full', resources: ['customers', 'orders', 'products'], since: '2023-01-01'});
// Check sync statusconst status = await tajo.connectors.status('shopify');console.log(status);// {// connected: true,// lastSync: '2024-01-15T10:30:00Z',// customersCount: 15420,// ordersCount: 8234,// productsCount: 342// }ติดตามอีเวนต์ตะกร้า
เพิ่มสคริปต์ Tajo ลงในธีม Shopify ของคุณ:
<!-- Add to theme.liquid before </head> -->{% if customer %}<script> window.tajoConfig = { customerId: "{{ customer.id }}", customerEmail: "{{ customer.email }}", customerName: "{{ customer.first_name }}" };</script>{% endif %}<script src="https://cdn.tajo.io/shopify.js"></script>จัดการ Webhook แบบกำหนดเอง
// Handle Shopify webhooks manuallyapp.post('/webhooks/shopify', async (req, res) => { const hmac = req.get('X-Shopify-Hmac-SHA256');
// Verify webhook signature if (!verifyShopifyWebhook(req.body, hmac)) { return res.status(401).send('Unauthorized'); }
const topic = req.get('X-Shopify-Topic');
// Forward to Tajo await tajo.connectors.handleWebhook('shopify', { topic, payload: req.body });
res.status(200).send('OK');});การมอนิเตอร์
เมตริกของ Dashboard
มอนิเตอร์การเชื่อมต่อ Shopify ของคุณใน dashboard ของ Tajo:
- สถานะการซิงก์: ความแข็งแรงของการเชื่อมต่อแบบเรียลไทม์
- ลูกค้าที่ซิงก์แล้ว: จำนวน contact จาก Shopify ทั้งหมด
- คำสั่งซื้อที่ติดตาม: อีเวนต์คำสั่งซื้อที่ประมวลผลแล้ว
- การกู้ตะกร้า: ประสิทธิภาพของการกู้ตะกร้าที่ถูกทิ้ง
- อัตราความผิดพลาด: ความพยายามซิงก์ที่ล้มเหลว
Log ของ Webhook
ดูสถานะการส่ง webhook:
tajo connectors logs shopify --type webhook --last 24hประวัติการซิงก์
ตรวจสอบการซิงก์ย้อนหลัง:
tajo connectors history shopify --limit 10การแก้ไขปัญหา
ปัญหาที่พบบ่อย
Rate Limit ของ API
Shopify มี rate limit ที่ 2 requests/second ให้ใช้การซิงก์แบบ batch สำหรับการ import ข้อมูลย้อนหลังจำนวนมาก
| ปัญหา | สาเหตุ | วิธีแก้ไข |
|---|---|---|
| ไม่ได้รับ webhook | สิทธิ์ของแอป | ติดตั้งแอปใหม่ด้วย scope ที่ถูกต้อง |
| ลูกค้าไม่ได้ซิงก์ | ไม่มีอีเมล | Shopify ต้องใช้อีเมลสำหรับลูกค้า |
| สินค้าหายไป | สถานะสินค้า | ตรวจสอบว่าสินค้าอยู่ในสถานะ “active” |
| ตะกร้าไม่ได้ติดตาม | สคริปต์ไม่โหลด | ตรวจสอบสคริปต์ใน theme.liquid |
โหมด Debug
เปิดใช้งาน logging แบบละเอียด:
connectors: shopify: debug: true log_level: verbose log_webhooks: trueทดสอบการเชื่อมต่อ
tajo connectors test shopify# ✓ API connection successful# ✓ Webhooks registered# ✓ Products accessible# ✓ Customers readable# ✓ Orders readableแนวทางปฏิบัติที่ดีที่สุด
- เริ่มด้วยร้านทดสอบ - ใช้ development store ก่อน
- รันการซิงก์ครั้งแรกนอกเวลาทำการ - การซิงก์ข้อมูลขนาดใหญ่อาจใช้เวลานาน
- จับคู่ attribute แบบกำหนดเอง - อย่าพึ่งพาเฉพาะการจับคู่เริ่มต้น
- เปิดใช้การติดตามตะกร้า - สำคัญมากสำหรับการกู้ตะกร้าที่ถูกทิ้ง
- มอนิเตอร์สุขภาพของ webhook - ตั้งค่าการแจ้งเตือนการส่งที่ล้มเหลว
- ใช้การ import แบบ batch - สำหรับข้อมูลย้อนหลังมากกว่า 10,000 รายการ
ความปลอดภัย
- OAuth 2.0 - การยืนยันตัวตนผ่านโทเคนที่ปลอดภัย
- Webhook verification - การตรวจสอบลายเซ็น HMAC
- การจัดเก็บที่เข้ารหัส - ข้อมูลรับรอง API เข้ารหัสขณะจัดเก็บ
- สิทธิ์แบบจำกัด - ให้เฉพาะสิทธิ์ที่จำเป็นขั้นต่ำ