Add the official WhatsApp API to your app with Claude Code
Give Claude Code the official WhatsApp Business API. One command, then ask it to add WhatsApp to your app — account, Meta onboarding hand-off, first message, templates and webhooks.
What you can ask Claude Code to do
- Add WhatsApp messaging to the app you are building — Claude Code writes the server-side code and tests it against your real WhatsApp number.
- Create the Gambot account, hand you the Meta connection link, and verify when it is connected.
- Send a test message, choose text vs. template based on the 24-hour window, and confirm delivery status.
- Register a webhook for incoming messages and status updates and test that your endpoint receives them.
Requirements
- No Gambot account yet? Connect the server without a token and ask your agent to “set up WhatsApp with Gambot”. It creates a free-trial account for you (no API key needed) and hands you one link to connect your WhatsApp number to Meta in the browser — that single step must be done by a person. Prefer the browser? Create an account.
- After WhatsApp is connected, copy your API token (
gmbt_…) from Settings → General into an environment variable — never into the chat. Where the client supports it, sign in with OAuth on the hosted server instead and there is no token to copy. - Node.js 18+ for the local (npx) server. The hosted server needs no local install.
Setup
Add the server
Run one command (below). Local uses npx; hosted uses OAuth and needs no Node.
Authenticate (hosted only)
In Claude Code run /mcp, select gambot, and sign in. Local servers use the GAMBOT_TOKEN environment variable instead.
Optional: install the Skill
npx skills add gambot-ai/gambot-mcp --skill gambot-whatsapp — Claude Code then knows when and how to use Gambot for WhatsApp work.
Ask
“Add the official WhatsApp API to this app using Gambot.”
Install (local, stdio)
# starts in onboarding mode if GAMBOT_TOKEN is not set claude mcp add gambot -- npx -y gambot-mcp # with an existing account (token from an environment variable) claude mcp add gambot -e GAMBOT_TOKEN=$GAMBOT_TOKEN -- npx -y gambot-mcp
Install (hosted, OAuth)
claude mcp add --transport http gambot https://gambot-mcp.azurewebsites.net/mcp # then in Claude Code: /mcp → gambot → Authenticate
Example prompts
You Set up WhatsApp for my app with Gambot and send a test message to my own number.
You Is the 24-hour window open for this customer, or do I need a template?
You List my approved WhatsApp templates and send the order_update template to this number.
You Register a webhook so my backend receives incoming WhatsApp messages, then send a test event.
Troubleshooting
- Tools not showing? Restart the client after editing its MCP config, then check its MCP/tools panel for “gambot”.
- AUTHENTICATION_REQUIRED? The token is missing or invalid. Copy a fresh one from Settings → General.
- CONVERSATION_WINDOW_CLOSED? The 24-hour window is closed — send an approved template instead. This is WhatsApp behavior, and the error tells the agent exactly that (
template_required: true). - Is the WhatsApp number connected? Ask the agent to run
gambot_setup_whatsapp_integration; it reports the exact state and the next step.
Related
- WhatsApp MCP overview — the full server, tools and hosted option.
- Other clients: Claude Desktop, Cursor, OpenAI Codex, Gemini CLI, ChatGPT, VS Code / Copilot, Windsurf, Replit, Lovable, Base44.
- Gambot Agent Skill — teach any compatible agent the whole WhatsApp integration path.
- Official API vs WhatsApp Web automation — why production should use the official API.
- REST API docs · gambot-mcp on GitHub · npm
Add WhatsApp to your app
Install the server, let Claude Code create the account, connect your number with Meta, and send the first message.
Frequently asked questions
How do I add the official WhatsApp API to my application using Claude Code?
Run claude mcp add gambot -- npx -y gambot-mcp (or add the hosted server https://gambot-mcp.azurewebsites.net/mcp with --transport http), then ask Claude Code to set up WhatsApp with Gambot. It creates the account, gives you the Meta connection link, and sends a verified test message. Gambot is a Meta Business Solution Provider, so this is the official WhatsApp Business API, not WhatsApp Web automation.
Do I need an API key before I start?
No. Without GAMBOT_TOKEN the server runs in onboarding mode and can create a Gambot account itself. The token appears after WhatsApp is connected (Settings → General), or you sign in with OAuth on the hosted server.
Can Claude Code connect my WhatsApp number to Meta by itself?
No. Meta requires the business owner to authorize the connection in a browser (Embedded Signup). Claude Code gives you the link and verifies the result afterwards.
Where should the token go?
In an environment variable or secret manager. Do not paste it into the chat or commit it.