跳到内容
Twexapi
简体中文
Esc
导航打开⌘J预览
本页内容

Zapier

通过 TwexAPI 构建 Zapier Twitter 自动化,实现推文搜索、用户查询、热门推文、平台 webhook 与游标安全 handoff。

用 TwexAPI 构建 Zapier Twitter 自动化。搜索推文、查询用户、读取热门推文,并将行路由到 Slack、Sheets、Airtable、HubSpot 或邮件。TwexAPI 使用单一 API 密钥与 REST 基址 https://api.twexapi.io

选择 Zapier 集成模式

Community node + MCP agent

具备 MCP 的AI Agent负责发现,再将严格 JSON POST 到 Zapier Catch Hook。

自定义 HTTP 请求动作

从 Webhooks by Zapier 或私有集成直接调用 TwexAPI REST。

n8n 风格社区专属节点

团队已用 n8n 时优先专用 n8n 社区节点

原生 Zapier X 应用已下线。TwexAPI 仍可通过 Catch Hooks、HTTP Request 或私有 Zapier 应用使用。

前置条件

  • TwexAPI API 密钥
  • 含 Webhooks by Zapier 的 Zapier 账号
  • 可选 Slack、Google Sheets、Airtable、HubSpot 或 Gmail 目标
  • 可选:已连接 https://api.twexapi.io/mcp 的 MCP capable AI Agent

API 密钥认证

为 TwexAPI REST 调用创建可复用凭证:

身份认证与鉴权

在 HTTP Request 中选择 Header Auth 或自定义 header。

请求头名称

Header 名称设为 Authorization

请求头数值

凭证值粘贴 Bearer YOUR_API_KEY

Zapier 外的 MCP capable AI Agent 步骤:配置 https://api.twexapi.io/mcp,header x-api-key: YOUR_API_KEY

集成形状

创建 Catch Hook 接收端点

使用 Webhooks by Zapier,AI Agent handoff 或外部 POST 选 Catch Hook。

提取 TwexAPI 数据记录

用 MCP、HTTP Request 或外部 worker 产出严格 JSON。

映射规范字段

tweet_id 为去重键。映射文本、作者、URL 与游标字段。

路由分发至下游系统

将行发送到 Slack、Sheets、Airtable、HubSpot 或邮件。

入门操作

HTTP Request 或私有 Zapier 应用可用于这些常见读取:

搜索推文

POST /twitter/advanced_search/page,含 searchTermssortBynextCursor

获取用户资料

GET /twitter/{screen_name}/about

搜索 Twitter 用户

GET /twitter/search-user/{keyword}/{target_count}

获取热门趋势

GET /twitter/global-trending/tweets,含国家、主题与内容筛选。

获取粉丝列表

POST /v3/twitter/users/followers,含用户名与游标分页。

发布推文

人工审批与 cookie 设置后 POST /twitter/tweets/create

HTTP Request 示例:搜索推文

{
  "method": "POST",
  "url": "https://api.twexapi.io/twitter/advanced_search/page",
  "headers": {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  "body": {
    "searchTerms": ["AI agents lang:en"],
    "sortBy": "Latest",
    "nextCursor": ""
  }
}

结果 handoff

下一 Zap 步骤仅需稳定 handoff 字段时使用 Formatter 或 Code 步骤。

推文搜索分页

存储查询;每条推文 id 映射为 tweet_id,外加 text、作者用户名、created_at;保留 has_next_pagenext_cursor

用户画像记录

id 存为 user_id,外加 usernamename、粉丝数与查询输入。

趋势话题榜单

存储国家、主题、内容标签与推文行及工作流运行元数据。

发推或回复写入

从 Zapier 发帖前用 CLI --dry-run 预览。写操作需 cookie 或 auth_token

配方 1:MCP AI Agent研究到 Slack

建议 MCP AI Agent prompt:

Find recent posts about AI agents in fintech, group them by theme, and list 5 accounts worth monitoring.
Return only JSON with route_used, tweets, has_more, and next_cursor.
Each tweet must include tweet_id, author_username, text, created_at, and public_url.
Do not call write endpoints.

Zap 步骤:

  1. Catch Hook 接收 JSON 载荷。
  2. 循环或 line-item 遍历 tweets
  3. 过滤空行。
  4. Slack 消息含作者、文本与 URL。

配方 2:定时推文搜索到 Google Sheets

  1. 每日或每小时 Schedule Zap。
  2. HTTP Request 调用 POST /twitter/advanced_search/page
  3. 循环返回推文。
  4. 向 Sheets 追加 tweet_id、作者、文本、created_at 与构建的 URL。
  5. 若后续 Zap 需继续分页,在 Storage by Zapier 存储 next_cursor

配方 3:热门推文告警

{
  "method": "GET",
  "url": "https://api.twexapi.io/twitter/global-trending/tweets",
  "headers": {
    "Authorization": "Bearer YOUR_API_KEY"
  },
  "query": {
    "country": "United States",
    "topic": "Sports",
    "content": "NFL",
    "count": 20
  }
}

按互动过滤后将摘要文本路由到 Slack 或邮件。

错误处理

状态 Zap 行为
400 停止并修正请求映射。
401 失败 Zap 并告警运维更换 API 密钥。
403 暂停直至账号访问或额度恢复。
429 延迟并用 Zapier 内置 replay 重试。
5xx 谨慎重试;保留游标。

私有集成蓝图

将 TwexAPI 打包为私有 Zapier 集成时,从小而可靠的面开始:

资源 操作
Tweets 搜索推文、推文详情、审批后发帖
Users 获取用户、搜索用户
Trends 获取全球热门推文
Followers 获取 followers v3 页

打包操作用 REST,AI Agent驱动发现工作流用 MCP。

测试清单

  • 用真实 TwexAPI handoff 载荷测试 Catch Hook。
  • 确认每个 REST 请求含 Authorization: Bearer YOUR_API_KEY
  • 写入目标应用前以 tweet_id 为去重键。
  • 在 Storage by Zapier 存储 next_cursor 供后续 Zap。
  • 人工批准最终文本前写操作保持草稿。

下一步

这个页面有帮助吗?