Connector guide3-minute read14 MCP toolsEnglish · Deutsch · Italiano

如何将 WhatsApp Business 连接到 Claude — 通过 MCP 从 Claude 发送 WhatsApp

使用 AnythingMCP 将 Meta 的 WhatsApp Business Cloud API 连接到 Claude。从 Claude Desktop、Claude Code 或 claude.ai 以自然语言发送文本、模板、媒体、语音消息和交互按钮。

HCBy HelpCode teamUpdated 3 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、无本地服务器。你可以跳过下方的本地安装步骤,直接进入客户端接入章节。

将 WhatsApp Business 连接到 Claude

WhatsApp Business Cloud API 是 Meta 托管的网关,用于通过程序发送 WhatsApp 消息——文本、模板、媒体、语音消息、交互按钮、位置。使用 AnythingMCP,你可以从 Claude Desktop、Claude Code 或 claude.ai 以自然语言驱动一切。无 SDK 拼接、无需为每种消息类型手写 JSON。

你能做什么

  • "把『您的订单已发货 — 跟踪 https://acme.com/t/12345』发送到 +86 138 0013 8000。"
  • "把 order_confirmation 模板(en_US)发送到 +1 555 123 4567,填入 'John' 和 'ORD-9912'。"
  • "把 https://acme.com/inv/9912.pdf 的发票 PDF 发送给我的客户,附加说明 'Invoice 9912'。"
  • "列出我 WABA 上已批准的模板,然后用意大利语向这位新线索发送欢迎模板。"

前提条件

  • 一个 WhatsApp Business Account (WABA),至少有一个已验证的发送号码。
  • 一个具有 whatsapp_business_messaging + whatsapp_business_management 权限的 永久 System User 访问令牌(临时 24 小时开发令牌可用于测试但会过期)。
  • 在本地或 cloud.anythingmcp.com 上运行的 AnythingMCP(3 分钟设置)。
  • Claude Desktop、Claude Code 或 claude.ai 账户。

步骤 1 — 获取 WhatsApp Business 凭证

  1. 打开 https://developers.facebook.com/ → 你的 App → WhatsApp → API Setup。记下 WhatsApp Business Account ID (WABA ID)。
  2. 前往 Meta Business Suite → Business Settings → System Users,创建 System User,分配你的 WABA,并使用 whatsapp_business_messaging + whatsapp_business_management 权限 生成新令牌。复制它 — 不会再显示。
  3. 确认你的发送号码已在 API Setup 中 验证(测试号码立即可用;生产环境需添加并验证自己的号码)。

步骤 2 — 安装 WhatsApp Business 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

点击 Install — adapter 现在已在你的目录中,包含 14 个工具。

步骤 3 — 一次性查找你的 phoneNumberId

请 Claude 调用 whatsapp_list_phone_numbers(将你的 WABA ID 作为 businessAccountId)。你会得到每个发送号码的 id — 固定这个值,每个发送工具都需要它作为 phoneNumberId

步骤 4 — 在 Claude 中添加连接器(无代码,4 次点击)

推荐路径 — 在 claude.ai web 上工作,无需触碰任何配置文件。

  1. 打开 claude.ai/customize/connectors
  2. 点击 "Add custom connector"
  3. 填入:
    • Name: WhatsApp Business
    • URL: https://cloud.anythingmcp.com/mcp
    • Authentication: Bearer token → 粘贴你的 MCP API Key(来自 AnythingMCP → Profile → MCP API Keys → New Key
  4. 点击 Connect 授权。

完成。所有 14 个 WhatsApp 工具出现在你的聊天中 — 开始输入提示。

进阶: Claude Desktop / Claude Code (JSON / CLI)

Claude Desktop — 编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或 %AppData%\Claude\claude_desktop_config.json(Windows):

{
  "mcpServers": {
    "whatsapp-business": {
      "url": "https://cloud.anythingmcp.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_MCP_API_KEY"
      }
    }
  }
}

重启 Claude Desktop。WhatsApp 工具会出现在 🔧 菜单中。

Claude Code — 一条 CLI 命令:

claude mcp add whatsapp-business \
  --transport http \
  --url https://cloud.anythingmcp.com/mcp \
  --header "Authorization: Bearer YOUR_MCP_API_KEY"

使用 claude mcp list 验证。

可用工具(共 14 个)

工具
发现whatsapp_list_phone_numbers, whatsapp_list_message_templates, whatsapp_get_message_template
文本与模板whatsapp_send_text_message, whatsapp_send_template_message
媒体(URL 或 media ID)whatsapp_send_image, whatsapp_send_audio, whatsapp_send_video, whatsapp_send_document
交互式与位置whatsapp_send_location, whatsapp_send_interactive_buttons
已读确认与资料whatsapp_mark_message_as_read, whatsapp_get_business_profile, whatsapp_update_business_profile

24 小时窗口 — 你的代理需要知道的

WhatsApp 仅允许 自由格式 消息(文本、媒体、交互式、位置)在用户最后向你的号码发送消息后的 24 小时 内发送。该窗口外仅允许 预审核模板 — 使用模板名称和语言调用 whatsapp_send_template_message

adapter 的 instructions 字段将这条规则告诉 Claude,因此当你在用户最后回复几天后请求"给那位客户发个跟进"时,Claude 会使用 whatsapp_send_template_message 而非自由文本。

语音消息

使用 whatsapp_send_audio,将 link 指向托管在公开 HTTPS URL 上的 OGG-Opus 文件。WhatsApp 将 OGG-Opus 显示为真正的语音消息(波形 + 播放按钮)。MP3 和 AMR 也可用,但显示为普通音频附件。

FAQ

没有已验证的企业号码也能用吗? Meta 的测试号码可用于测试(仅发送给作为测试者添加的号码)。在生产环境向任何收件人发送,你的发送号码必须在 WABA 上已验证并已注册。

在 24 小时窗口外发送自由文本会怎样? Meta 返回错误代码 131047("Re-engagement message")。使用 whatsapp_send_template_message

adapter 能接收入站消息吗? 不能直接接收 — Meta 通过 webhook 处理入站,而 AnythingMCP REST 引擎仅支持出站。在 AnythingMCP 旁边运行一个小型 webhook 接收器,使用此连接器处理出站 + whatsapp_mark_message_as_read 用于确认。

Claude Code 和 Claude Desktop 一样工作吗? 是的 — 同样的 MCP URL。

下一步

Ready to ship

Your WhatsApp agent is one click away.

Install the connector, paste the key, prompt Claude. Free for 7 days, no credit card.