Zapier 连接器
通过 Tajo 将 Zapier 连接到 Brevo,将数千款第三方应用与您的营销自动化工作流桥接,实现整个技术栈的无代码数据流和事件驱动触发。
概览
| 属性 | 值 |
|---|---|
| 平台 | Zapier |
| 类别 | 自动化(自定义) |
| 设置复杂度 | 简单 |
| 官方集成 | 否 |
| 同步数据 | 事件、联系人、工作流、触发器 |
| 认证方式 | API 密钥 / OAuth 2.0 |
功能
- 多应用编排 - 通过 Zap 工作流将 6,000+ 款应用连接到 Brevo
- Webhook 触发 - 从任何 Zapier 连接的应用接收实时事件
- 联系人同步 - 在 Zapier 连接的平台和 Brevo 之间推送和拉取联系人
- 事件转发 - 将应用事件通过 Tajo 路由到 Brevo 自动化
- 多步骤 Zap - 使用过滤器、格式化器和延迟构建复杂工作流
- 自定义 Zapier 应用 - 使用 Zapier Platform CLI 构建定制集成
前提条件
开始之前,请确保您已具备:
- Zapier 账户(免费版或以上)
- 具有 API 访问权限的 Brevo 账户
- 具有连接器权限的 Tajo 账户
- 已安装 Node.js 18+(用于基于 CLI 的集成开发)
认证
API 密钥认证
# Set your Zapier Platform credentialsexport ZAPIER_DEPLOY_KEY=your_deploy_keyexport TAJO_API_KEY=your_tajo_api_keyexport BREVO_API_KEY=your_brevo_api_keyOAuth 2.0
Zapier 支持 OAuth 2.0 用于在 Zap 中连接第三方服务:
const authentication = { type: 'oauth2', oauth2Config: { authorizeUrl: { url: 'https://your-app.com/oauth/authorize', params: { client_id: '{{process.env.CLIENT_ID}}', state: '{{bundle.inputData.state}}', redirect_uri: '{{bundle.inputData.redirect_uri}}', response_type: 'code' } }, getAccessToken: { url: 'https://your-app.com/oauth/token', method: 'POST', body: { code: '{{bundle.inputData.code}}', client_id: '{{process.env.CLIENT_ID}}', client_secret: '{{process.env.CLIENT_SECRET}}', grant_type: 'authorization_code', redirect_uri: '{{bundle.inputData.redirect_uri}}' } }, refreshAccessToken: { url: 'https://your-app.com/oauth/token', method: 'POST', body: { refresh_token: '{{bundle.authData.refresh_token}}', client_id: '{{process.env.CLIENT_ID}}', client_secret: '{{process.env.CLIENT_SECRET}}', grant_type: 'refresh_token' } } }};配置
基础设置
connectors: zapier: enabled: true webhook_url: "https://hooks.zapier.com/hooks/catch/YOUR_HOOK_ID"
sync: contacts: true events: true workflows: true
triggers: - contact_created - order_placed - form_submitted
mapping: email: email first_name: FIRSTNAME last_name: LASTNAMEWebhook 配置
配置 Tajo 向 Zapier Webhook 发送事件:
webhooks: zapier: url: "https://hooks.zapier.com/hooks/catch/YOUR_HOOK_ID" events: - contact.created - contact.updated - order.completed - cart.abandoned retry: max_attempts: 3 backoff: exponentialAPI 端点
| 端点 | 方法 | 描述 |
|---|---|---|
https://hooks.zapier.com/hooks/catch/{id} | POST | Webhook 捕获钩子 |
https://nla.zapier.com/api/v1/dynamic/exposed/ | GET | 列出已暴露操作 |
https://nla.zapier.com/api/v1/dynamic/exposed/{action_id}/execute/ | POST | 执行操作 |
https://zapier.com/api/platform/cli/apps | GET | 列出已注册应用 |
https://zapier.com/api/platform/cli/push | POST | 部署集成 |
代码示例
初始化连接器
import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({ apiKey: process.env.TAJO_API_KEY, brevoApiKey: process.env.BREVO_API_KEY});
// Connect Zapier via webhookawait tajo.connectors.connect('zapier', { webhookUrl: process.env.ZAPIER_WEBHOOK_URL, events: ['contact.created', 'order.completed']});使用 Platform CLI 构建自定义 Zapier 集成
const { version: platformVersion } = require('zapier-platform-core');
const App = { version: require('./package.json').version, platformVersion, authentication, triggers: { new_contact: { key: 'new_contact', noun: 'Contact', display: { label: 'New Contact in Tajo', description: 'Triggers when a new contact is synced.' }, operation: { perform: async (z, bundle) => { const response = await z.request({ url: 'https://api.tajo.io/v1/contacts', params: { since: bundle.meta.lastPoll } }); return response.data; } } } }, creates: { sync_contact: { key: 'sync_contact', noun: 'Contact', display: { label: 'Sync Contact to Brevo', description: 'Syncs a contact to Brevo via Tajo.' }, operation: { inputFields: [ { key: 'email', required: true, type: 'string' }, { key: 'firstName', type: 'string' }, { key: 'lastName', type: 'string' } ], perform: async (z, bundle) => { const response = await z.request({ method: 'POST', url: 'https://api.tajo.io/v1/contacts/sync', body: bundle.inputData }); return response.data; } } } }};
module.exports = App;处理传入的 Zapier Webhook
app.post('/webhooks/zapier', async (req, res) => { const { event, data } = req.body;
await tajo.connectors.handleWebhook('zapier', { topic: event, payload: data });
res.status(200).json({ status: 'received' });});速率限制
| 套餐 | 请求 | 任务/月 | 轮询间隔 |
|---|---|---|---|
| 免费 | 100/天 | 100 | 15 分钟 |
| 入门 | 1,000/天 | 750 | 15 分钟 |
| 专业 | 5,000/天 | 2,000 | 2 分钟 |
| 团队 | 10,000/天 | 50,000 | 1 分钟 |
Zapier 任务限制
每个 Zap 步骤计为一个任务。多步骤 Zap 每次执行消耗多个任务。在 Zapier 控制台中监控您的任务使用情况以避免超额。
故障排除
| 问题 | 原因 | 解决方案 |
|---|---|---|
| Webhook 未触发 | Zap 已关闭 | 在 Zapier 控制台中检查 Zap 状态 |
| 数据未映射 | 字段名称不匹配 | 验证应用之间的字段键一致 |
| 重复联系人 | 未配置去重 | 在 Tajo 中启用基于邮箱的去重 |
| Zap 错误 | API 速率限制达到 | 添加延迟步骤或升级 Zapier 套餐 |
| 认证过期 | 令牌未刷新 | 在 Zapier 中重新认证连接 |
调试模式
connectors: zapier: debug: true log_level: verbose log_webhooks: true最佳实践
- 使用 Webhook 而非轮询 - Webhook 提供实时数据流,轮询存在延迟
- 添加错误处理 - 使用 Zapier Paths 处理成功/失败场景
- 去重数据 - 启用去重键以防止重复记录
- 监控任务用量 - 在达到任务限制前设置提醒
- 合理使用过滤器 - 在 Zap 早期过滤以减少不必要的任务消耗
- 版本化 CLI 集成 - 为 Platform CLI 应用使用语义化版本控制
安全
- 仅 HTTPS - 所有 Webhook URL 必须使用 HTTPS
- API 密钥轮换 - 定期通过 Zapier 控制台轮换密钥
- OAuth 2.0 - 第三方服务认证使用 OAuth
- Webhook 验证 - 验证传入的 Webhook 签名
- 范围权限 - 每个 Zap 授予最低所需访问权限