Skip the install. Get this working in under 2 minutes.
Start a free trial on cloud.anythingmcp.com, add the WhatsApp Business Cloud API in one click, then point your AI client (Claude, ChatGPT, Copilot or Cursor) at the generated MCP endpoint. No Docker, no git clone, zero engineering experience required.
Summary
使用 AnythingMCP 将 Meta 的 WhatsApp Business Cloud API 暴露为 MCP 服务器。14 个开箱即用工具:文本、模板、媒体(图片/音频/语音/视频/文档)、位置、交互按钮、企业资料管理。Bearer 鉴权,无需 SDK,无需客户端代码。
试试这样问
WhatsApp Business Cloud API 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装?直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → WhatsApp Business、粘贴永久 System User 访问令牌 + WhatsApp Business Account ID、生成 MCP API Key — 完成。无 Docker、无
git clone、无本地服务器。你可以跳过下方的本地安装步骤,直接进入客户端接入章节。
Model Context Protocol 上的 WhatsApp Business
WhatsApp Business Cloud API 是 Meta 官方托管的网关,用于通过程序发送 WhatsApp 消息——文本、预审核模板、媒体、位置标记、交互式按钮流程、企业资料管理。AnythingMCP 将其封装为 MCP 服务器,让任何代理——Claude、ChatGPT、Copilot、你自己的——都能以自然语言驱动它。
WhatsApp adapter 内置,无需维护 SDK,无需编写客户端代码:引擎处理 Bearer 鉴权,并为每种消息类型生成与 Meta messaging_product=whatsapp 模式完全匹配的请求。
没有 AnythingMCP 时 WhatsApp 为何麻烦
| 步骤 | WhatsApp Cloud API 要求 |
|---|---|
| 1 | 在 Meta Business Suite 生成永久 System User 访问令牌(≠ 临时的 24 小时开发令牌),权限为 whatsapp_business_messaging + whatsapp_business_management |
| 2 | 在你的 WhatsApp Business Account (WABA) 下找到每个发送号码的 phoneNumberId |
| 3 | 为每种消息类型构建正确的 JSON 主体—— text/template/image/audio/video/document/location/interactive ——每种都有自己的模式和字段位置的怪癖 |
| 4 | 保持在当前支持的 Graph API 版本上(v15 已下线,v20 于 2026 年 9 月到期;adapter 使用 v22.0) |
| 5 | 遵守 24 小时客户服务窗口——窗口外只能发送预审核模板 |
这一切是完整的 BEARER_TOKEN 鉴权配置 + 14 个 message-shape 工具,一次性以 JSON 在 adapter 规范中声明。无需维护客户端代码。
安装
git clone https://github.com/HelpCode-ai/anythingmcp.git
cd anythingmcp && docker compose up -d
打开 http://localhost:3000/connectors/store,选择 WhatsApp Business 并填入:
| 字段 | 值 |
|---|---|
WHATSAPP_ACCESS_TOKEN | 永久 System User 访问令牌 |
WHATSAPP_BUSINESS_ACCOUNT_ID | 你的 WABA ID(例如 123456789012345) |
在 Profile → MCP API Keys 生成 MCP API Key,并将代理指向 http://localhost:4000/mcp。
可用工具 (14)
| 工具 | 作用 |
|---|---|
whatsapp_list_phone_numbers | 发现 WABA 上每个号码的 phoneNumberId |
whatsapp_list_message_templates | 列出已批准的模板及其组件 |
whatsapp_get_message_template | 按 ID 获取单个模板 |
whatsapp_send_text_message | 发送自由格式文本(仅在 24 小时窗口内) |
whatsapp_send_template_message | 发送预审核模板(始终允许) |
whatsapp_send_image | 通过公开 URL 或 media ID 发送 JPG/PNG |
whatsapp_send_audio | 发送音频文件——OGG-Opus 显示为真正的语音消息 |
whatsapp_send_video | 发送 MP4/3GPP 视频 |
whatsapp_send_document | 发送 PDF/DOC/XLS,可选文件名 |
whatsapp_send_location | 发送位置 |
whatsapp_send_interactive_buttons | 发送 1–3 个回复按钮 |
whatsapp_mark_message_as_read | 发送已读确认(双蓝勾) |
whatsapp_get_business_profile | 读取公开企业资料 |
whatsapp_update_business_profile | 更新 about/地址/邮箱/网站 |
24 小时窗口解释
WhatsApp 强制 客户服务窗口:自由格式消息(文本、媒体、交互式、位置)仅在用户最后向你的号码发送消息的 24 小时内允许。窗口外只允许 预审核模板 ——你在 Meta Business Suite 中创建它们,等待批准,然后使用模板名称和语言代码调用 whatsapp_send_template_message。
adapter 不会为你跟踪窗口。它只调用 API;如果你尝试在窗口外发送自由文本,Meta 会返回错误 131047「Re-engagement message」。adapter 的 instructions 字段解释了这条规则,让你的代理知道何时切换到模板。
媒体 — URL 还是上传
WhatsApp 接受两种方式的媒体:先将二进制上传到 /PHONE_NUMBER_ID/media 获取 media_id,或者传递公开的 HTTPS link。AnythingMCP 推荐 link 路径,因为 REST 引擎不会在单次工具调用中编排 multipart 上传 + 发送的舞步。将文件托管在 CDN 或签名 URL 桶上,并将 URL 传递给 whatsapp_send_image / audio / video / document。如果你在其他地方预上传,mediaId 字段可作为应急出口。
入站消息 — 不在范围内
此连接器仅支持 出站。WhatsApp 通过你自己托管的 webhook 投递入站消息,而 AnythingMCP 的当前架构是 request/response。如果你需要回复用户消息的聊天机器人,请在 AnythingMCP 旁边运行一个小型 webhook 接收器,并使用此连接器处理出站(加上 whatsapp_mark_message_as_read 用于已读确认)。
下一步
这份指南对你有帮助吗?