Skip to main content
WH

WhatsApp Cloud

v0.2.0API 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

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

All credentials are encrypted at rest in an isolated vault scoped per organization. OAuth2 tokens are automatically refreshed before expiry. Your agent code never sees raw secrets โ€” it receives scoped, short-lived session tokens.
Servers โ€” Every LatAm commerce API your agent needs | CodeSpar