---
title: "ตัวเชื่อม Shopify"
description: "คู่มือการเชื่อมต่อ Shopify อย่างครบถ้วนสำหรับการซิงก์ลูกค้า คำสั่งซื้อ สินค้า และอีเวนต์ตะกร้ากับ Brevo"
url: https://tajo.io/th/docs/connectors/ecommerce/shopify/
markdown: https://tajo.io/th/docs/connectors/ecommerce/shopify.md
lang: th-TH
robots: noindex
---

ขอสิทธิ์ใช้งานล่วงหน้า

กรอกชื่อและที่อยู่อีเมลที่ทำงานของคุณ เราจะส่งลิงก์เพื่อยืนยันคำขอเข้าใช้งาน Tajo ทางอีเมล

# ตัวเชื่อม Shopify

สถานะตัวเชื่อม: กำลังพัฒนา กำลังสร้าง ยังไม่ได้รับการยืนยัน

| ฟิลด์ต้นทาง | ฟิลด์ปลายทาง | ค่าตัวอย่าง |
| --- | --- | --- |
| `record.id` | `source_id` | `record_1042` |
| `record.updated_at` | `updated_at` | `2026-10-18T08:00:00Z` |
| `record.value` | `value` | `sample_value` |

เชื่อมต่อร้านค้า Shopify ของคุณกับ Brevo เพื่อซิงก์ข้อมูลลูกค้าแบบครบถ้วน กู้ตะกร้าที่ถูกทิ้ง และทำแคมเปญ marketing อัตโนมัติ

## ภาพรวม

| คุณสมบัติ | ค่า |
| --- | --- |
| **แพลตฟอร์ม** | Shopify |
| **หมวดหมู่** | อีคอมเมิร์ซ |
| **ความซับซ้อนในการตั้งค่า** | ง่าย |
| **Official Integration** | ไม่ |
| **ข้อมูลที่ซิงก์** | ลูกค้า, คำสั่งซื้อ, สินค้า, ตะกร้า, อีเวนต์ |
| **Skills ที่พร้อมใช้งาน** | 12 |

## ฟีเจอร์

- **ซิงก์ลูกค้าแบบเรียลไทม์** - ข้อมูลลูกค้าถูกซิงก์ไปยัง contact ใน Brevo ทันที
- **ติดตามคำสั่งซื้อ** - อีเวนต์คำสั่งซื้อสำหรับโฟลว์หลังการขาย
- **ซิงก์แคตาล็อกสินค้า** - สินค้าพร้อมใช้สำหรับการแนะนำ
- **ตะกร้าที่ถูกทิ้ง** - ติดตามและกู้ตะกร้าที่ถูกทิ้ง
- **พฤติกรรมการเรียกดู** - ติดตามการดูหน้าและความสนใจในสินค้า
- **รองรับหลายร้าน** - เชื่อมต่อ Shopify ได้หลายร้าน

## สิ่งที่ต้องเตรียม

ก่อนเริ่มต้น โปรดตรวจสอบให้แน่ใจว่าคุณมี:

1. ร้านค้า Shopify พร้อมสิทธิ์ admin
2. บัญชี Brevo ที่เข้าถึง API ได้
3. บัญชี Tajo

## การติดตั้ง

### ตัวเลือกที่ 1: Shopify App Store (แนะนำ)

1. เข้าเยี่ยมชม [แอป Tajo บน Shopify App Store](https://apps.shopify.com/tajo)
2. คลิก “Add app”
3. ให้สิทธิ์ตามที่ร้องขอ
4. เชื่อมต่อบัญชี Brevo ของคุณ

### ตัวเลือกที่ 2: ติดตั้งด้วยตนเอง

#### ขั้นตอนที่ 1: สร้าง Shopify App

1. ไปที่ Shopify admin → Settings → Apps and sales channels
2. คลิก “Develop apps” → “Create an app”
3. ตั้งชื่อว่า “Tajo Integration”

#### ขั้นตอนที่ 2: ตั้งค่า API Scopes

เปิดใช้งาน scope เหล่านี้:

```
read_customers
write_customers
read_orders
read_products
read_checkouts
write_script_tags
```

#### ขั้นตอนที่ 3: ติดตั้งแอป

```bash
# Using Tajo CLI
tajo 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` | มีการอัปเดตตะกร้า |

## การตั้งค่า

### การตั้งค่าพื้นฐาน

```yaml
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 แบบกำหนดเอง

```yaml
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
```

### การซิงก์สินค้า

ซิงก์สินค้าสำหรับการแนะนำในอีเมล:

```yaml
sync:
  products:
    enabled: true
    include_variants: true
    include_images: true
    categories_as_tags: true

    # Filter products
    filter:
      status: active
      exclude_tags: ["hidden", "wholesale-only"]
```

### การติดตามสต็อกสินค้า

เปิดใช้งานการซิงก์ระดับสต็อก:

```yaml
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](https://tajo.io/th/docs/skills/data-sync/customer-sync) | ซิงก์ลูกค้าแบบเรียลไทม์ |
| Order Events | ติดตามวงจรคำสั่งซื้อ |
| [Abandoned Cart](https://tajo.io/th/docs/skills/email-marketing/abandoned-cart) | อีเมลกู้ตะกร้า |
| Welcome Series | ต้อนรับลูกค้าใหม่ |
| Post-Purchase | ติดตามหลังคำสั่งซื้อ |
| Win-Back | ดึงลูกค้าที่ไม่ active กลับมา |
| Browse Abandonment | ติดตามความสนใจสินค้า |
| Replenishment | เตือนการสั่งซื้อซ้ำ |

## ตัวอย่างโค้ด

### เริ่มต้นใช้งานตัวเชื่อม

```javascript
import { TajoClient } from '@tajo/sdk';

const tajo = new TajoClient({
  apiKey: process.env.TAJO_API_KEY,
  brevoApiKey: process.env.BREVO_API_KEY
});

// Connect Shopify store
await tajo.connectors.connect('shopify', {
  shopUrl: 'your-store.myshopify.com',
  apiKey: process.env.SHOPIFY_API_KEY,
  apiSecret: process.env.SHOPIFY_API_SECRET
});
```

### รันการซิงก์ครั้งแรก

```javascript
// Full historical sync
await tajo.connectors.sync('shopify', {
  type: 'full',
  resources: ['customers', 'orders', 'products'],
  since: '2023-01-01'
});

// Check sync status
const 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 ของคุณ:

```liquid
<!-- 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.example.com/shopify.js"></script>
```

Caution

ที่อยู่ `example.com` ด้านบนเป็นเพียงตัวอย่างชั่วคราวจนกว่าปลายทางของ Tajo จะพร้อมใช้งาน

### จัดการ Webhook แบบกำหนดเอง

```javascript
// Handle Shopify webhooks manually
app.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:

```bash
tajo connectors logs shopify --type webhook --last 24h
```

### ประวัติการซิงก์

ตรวจสอบการซิงก์ย้อนหลัง:

```bash
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 แบบละเอียด:

```yaml
connectors:
  shopify:
    debug: true
    log_level: verbose
    log_webhooks: true
```

### ทดสอบการเชื่อมต่อ

```bash
tajo connectors test shopify
# ✓ API connection successful
# ✓ Webhooks registered
# ✓ Products accessible
# ✓ Customers readable
# ✓ Orders readable
```

## แนวทางปฏิบัติที่ดีที่สุด

1. **เริ่มด้วยร้านทดสอบ** - ใช้ development store ก่อน
2. **รันการซิงก์ครั้งแรกนอกเวลาทำการ** - การซิงก์ข้อมูลขนาดใหญ่อาจใช้เวลานาน
3. **จับคู่ attribute แบบกำหนดเอง** - อย่าพึ่งพาเฉพาะการจับคู่เริ่มต้น
4. **เปิดใช้การติดตามตะกร้า** - สำคัญมากสำหรับการกู้ตะกร้าที่ถูกทิ้ง
5. **มอนิเตอร์สุขภาพของ webhook** - ตั้งค่าการแจ้งเตือนการส่งที่ล้มเหลว
6. **ใช้การ import แบบ batch** - สำหรับข้อมูลย้อนหลังมากกว่า 10,000 รายการ

## ความปลอดภัย

- **OAuth 2.0** - การยืนยันตัวตนผ่านโทเคนที่ปลอดภัย
- **Webhook verification** - การตรวจสอบลายเซ็น HMAC
- **การจัดเก็บที่เข้ารหัส** - ข้อมูลรับรอง API เข้ารหัสขณะจัดเก็บ
- **สิทธิ์แบบจำกัด** - ให้เฉพาะสิทธิ์ที่จำเป็นขั้นต่ำ

## แหล่งข้อมูลที่เกี่ยวข้อง

- [WooCommerce Connector](https://tajo.io/th/docs/connectors/ecommerce/woocommerce)
- [Customer Sync Skill](https://tajo.io/th/docs/skills/data-sync/customer-sync)
- [Abandoned Cart Skill](https://tajo.io/th/docs/skills/email-marketing/abandoned-cart)
- [Brevo Contacts API](https://tajo.io/th/docs/contact-management)
