BigCommerce 连接器
BigCommerce 连接器
通过 Tajo 将您的 BigCommerce 商店连接到 Brevo,实现完整的电商数据同步。同步客户、订单、产品和购物车事件,助力精准营销活动、弃购恢复和购后自动化。
概览
| 属性 | 值 |
|---|---|
| 平台 | BigCommerce |
| 类别 | 电子商务 |
| 设置复杂度 | 中等 |
| 官方集成 | 否 |
| 同步数据 | 客户、订单、产品、购物车 |
| 可用技能 | 10 |
功能
- 客户同步 - 实时将客户数据同步到 Brevo 联系人
- 订单跟踪 - 订单全生命周期事件,用于购后营销流程
- 产品目录同步 - 同步产品,用于邮件推荐和动态内容
- 购物车放弃 - 通过自动化邮件追踪并挽回放弃的购物车
- 多店面支持 - 连接多个 BigCommerce 店面
- Webhook 驱动更新 - 通过 BigCommerce Webhook 实时更新数据
- 自定义字段 - 将 BigCommerce 自定义字段映射到 Brevo 联系人属性
- 库存跟踪 - 同步库存水平,用于补货通知
前提条件
开始之前,请确保您已具备:
- 具有店主或管理员访问权限的 BigCommerce 商店
- 具有适当 OAuth 范围的 BigCommerce API 账户
- 您的商店哈希(在商店 URL 或 API 凭据中查找)
- 具有 API 访问权限的 Brevo 账户
- 具有 API 凭据的 Tajo 账户
认证
API 账户凭据
BigCommerce 使用基于 OAuth 的 API 账户。在 BigCommerce 控制面板的设置 > API > API 账户中创建。
您将获得:
- Client ID - 您的应用标识符
- Client Secret - 您的应用密钥(请安全存储)
- Access Token - 用于 API 认证
- Store Hash - 您的唯一商店标识符
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 范围
| 范围 | 访问级别 | 用途 |
|---|---|---|
store_v2_customers | 读取 | 客户数据同步 |
store_v2_orders | 读取 | 订单事件跟踪 |
store_v2_products | 读取 | 产品目录同步 |
store_cart | 读取 | 购物车放弃跟踪 |
store_v2_information | 读取 | 商店配置 |
store_v2_content | 读取 | 店面内容 |
配置
基础设置
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_GROUPWebhook 配置
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 端点
| 方法 | 端点 | 描述 |
|---|---|---|
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 | 列出产品变体 |
GET | /v3/carts | 列出购物车 |
GET | /v3/abandoned-carts | 列出放弃的购物车 |
POST | /v3/hooks | 创建 Webhook |
GET | /v3/catalog/categories | 列出分类 |
代码示例
初始化 BigCommerce 连接器
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// }速率限制
| 计划 | 限制 | 详情 |
|---|---|---|
| 标准版 | 150 请求/30 秒 | 每商店 |
| Plus 版 | 300 请求/30 秒 | 每商店 |
| Pro 版 | 450 请求/30 秒 | 每商店 |
| 企业版 | 无限制 | 自定义限制 |
附加限制:
| 资源 | 限制 |
|---|---|
| Webhook | 每商店 100 个 |
| 每页 | 最多 250 条记录 |
| 并发请求 | 取决于计划 |
速率限制响应头
监控 X-Rate-Limit-Requests-Left 和 X-Rate-Limit-Time-Reset-Ms 请求头,以在限制范围内管理您的 API 使用情况。
故障排除
| 问题 | 原因 | 解决方案 |
|---|---|---|
401 Unauthorized | 访问令牌无效 | 在 BigCommerce 管理中重新生成 API 凭据 |
403 Forbidden | 缺少 OAuth 范围 | 检查 API 账户范围并添加所需权限 |
| Webhook 未触发 | 已达 Webhook 限制 | 检查 Webhook 数量(最多 100 个)并删除未使用的 |
| 购物车事件缺失 | 店面脚本未加载 | 验证 BigCommerce 店面上的追踪脚本 |
| 产品不同步 | 目录缓存 | 触发手动同步或等待 Webhook 更新 |
429 Too Many Requests | 超出速率限制 | 实施带速率限制头监控的请求队列 |
| 客户组缺失 | V2 与 V3 API | 客户组使用 V2 API;检查端点版本 |
最佳实践
- 尽量使用 V3 API - V3 API 提供更好的分页、过滤和 JSON 响应
- 监控速率限制头 - 跟踪
X-Rate-Limit-Requests-Left以避免超限 - 注册 Webhook 实现实时同步 - 使用 Webhook 而非轮询获取客户和订单更新
- 批量更新客户 - 使用 V3 批量客户端点进行大型数据同步
- 产品同步包含变体 - 同步产品变体以准确跟踪库存
- 设置放弃购物车 Webhook - 对于购物车恢复邮件自动化至关重要
- 使用分页 - 始终对列表端点进行分页;每页最多 250 条记录
安全
- OAuth 令牌认证 - 安全的基于令牌的 API 访问
- 范围权限 - API 账户限制在特定数据范围内
- 仅 HTTPS - 所有 API 通信通过 TLS 加密
- Webhook 验证 - 使用商店哈希验证 Webhook 来源
- PCI DSS 合规 - BigCommerce 安全处理支付数据
- SOC 2 Type II - BigCommerce 平台通过 SOC 2 认证