Connector guide2-minute read14 MCP toolsEnglish · Deutsch · Italiano

WhatsApp Business 接入 MCP — 从任意 AI 代理发送 WhatsApp 消息

使用 AnythingMCP 将 Meta 的 WhatsApp Business Cloud API 暴露为 MCP 服务器。14 个开箱即用工具:文本、模板、媒体(图片/音频/语音/视频/文档)、位置、交互按钮、企业资料管理。Bearer 鉴权,无需 SDK,无需客户端代码。

HCBy HelpCode teamUpdated 2 min read Open source on GitHub

No credit card · 7-day trial · Self-host alternative available

WhatsApp Business Cloud API

MCP connector

WhatsApp Business Cloud API

Send WhatsApp messages (text, templates, images, audio/voice notes, video, documents, location, interactive buttons) from a WhatsApp Business account using Meta's Cloud API. Free tier of 1000 service conversations per month per business account.

Tools

14

Region

INTL

Category

Messaging

Authentication

Required env vars

WHATSAPP_ACCESS_TOKENWHATSAPP_BUSINESS_ACCOUNT_ID
Install in one click on Cloud

7-day free trial · No credit card

  • 7-day free trial
    No credit card required
  • GDPR & SOC 2 ready
    EU data residency, audit logs
  • Open-source on GitHub
    Source-available BSL-1.1
  • Works with ChatGPT, Claude, Gemini
    Any MCP-compatible client

No install? Use cloud.anythingmcp.com directly.

Sign in, install the WhatsApp Business Cloud API in one click, paste the credentials, mint an MCP API key — done. No Docker, no git clone, no local server to run.

Open Cloud

💡 无需安装?直接使用 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 用于已读确认)。

下一步

Ready to ship

Your WhatsApp agent is one click away.

Install the connector, paste the key, prompt any MCP client. Free for 7 days, no credit card.