Skip to main content
WH

WhatsApp Cloud

v0.2.1API Key

Meta-direct WhatsApp Cloud API. Distinct from our Z-API/Evolution/Take Blip/Zenvia wrappers — this is the official Graph API integration (no middleman fees, requires approved WABA). 11 tools across messages, media, templates.

22 tools4 env vars🌐 GLOBALstable on npm

What your agent can do

WhatsApp Cloud gives your agent 22 tools it calls directly — pick the ones it needs, in Claude, Cursor, or any MCP client.

  • send_text_messageSend a plain text message. For business-initiated conversations outside the 24h customer-service window, use send_template_message instead.
  • send_template_messageSend an approved message template. Required for business-initiated conversations. Templates must be pre-approved by Meta via create_template.
  • send_media_messageSend an image, video, document, or audio. Supply either `link` (public URL) or `id` (media_id from upload_media).
Example call
// Your agent calls a tool directly — no glue code.
// CodeSpar's managed tier handles OAuth2, token rotation and rate limits.
const result = await session.call("send_text_message", { /* ... */ });

Install

terminal
$ npm install @codespar/mcp-whatsapp-cloud

Quickstart

Add this entry to your claude_desktop_config.json (or any MCP-compatible client config).

claude_desktop_config.json
{
  "mcpServers": {
    "whatsapp-cloud": {
      "command": "npx",
      "args": [
        "-y",
        "@codespar/mcp-whatsapp-cloud"
      ],
      "env": {
        "WHATSAPP_ACCESS_TOKEN": "<your_whatsapp_access_token>",
        "WHATSAPP_PHONE_NUMBER_ID": "<your_whatsapp_phone_number_id>",
        "WHATSAPP_BUSINESS_ACCOUNT_ID": "<your_whatsapp_business_account_id>"
      }
    }
  }
}

After restart, your agent can call any of the 22 tools below — try send_text_message first.

Environment variables · 4

Required to authenticate the server. Stored encrypted when using CodeSpar managed hosting.

WHATSAPP_ACCESS_TOKEN
requiredsecret

Meta system-user access token (permanent). Used as Bearer token for Graph API.

WHATSAPP_PHONE_NUMBER_ID
required

WhatsApp Business phone number ID registered with Meta.

WHATSAPP_BUSINESS_ACCOUNT_ID
required

WhatsApp Business Account (WABA) ID. Used for template management.

WHATSAPP_GRAPH_VERSION
optional

Graph API version. Defaults to v21.0. Meta bumps quarterly.

Available tools · 22

Each tool is independent — your agent loads only what it needs to reduce context and response time.

WRITEsend_text_message
Send a plain text message. For business-initiated conversations outside the 24h customer-service window, use send_template_message instead.
WRITEsend_template_message
Send an approved message template. Required for business-initiated conversations. Templates must be pre-approved by Meta via create_template.
WRITEsend_media_message
Send an image, video, document, or audio. Supply either `link` (public URL) or `id` (media_id from upload_media).
WRITEsend_interactive_message
Send an interactive message (reply buttons or list). Supply a fully-formed `interactive` object per Cloud API spec.
WRITEsend_interactive_cta_url
Send an interactive message with a single CTA URL button. Opens the URL when the recipient taps it. Available without template approval inside the 24h window.
WRITEsend_interactive_flow
Send a WhatsApp Flow message. Flows are Meta's structured UI experiences (forms, appointment booking, etc.) rendered inside WhatsApp.
WRITEsend_location_message
Send a location pin with latitude/longitude and optional name/address.
WRITEsend_contacts_message
Send one or more contact cards (vCard-like). Each contact includes name and at least one of phones, emails, addresses, urls, or org.

Compatible frameworks

MCP is a protocol — any framework that speaks it can mount this server.

Claude Agent SDKAnthropic
OpenAI AgentsOpenAI
Vercel AI SDKVercel
LangChainLangChain
LlamaIndexLlamaIndex
CrewAICrewAI
MastraMastra
Any MCP clientProtocol

Frequently asked questions

Run `npx -y @codespar/mcp-whatsapp-cloud` and add the config block above to your MCP client — Claude, Cursor, VS Code, or any MCP-compatible client. No build step, no SDK required. Prefer hosted? CodeSpar's managed tier runs it for you with auth handled.
WhatsApp Cloud — MCP server · 22 tools | CodeSpar