Gambot MCP agent
MCP server for the Gambot WhatsApp Business API - send WhatsApp messages & templates, manage CRM, leads & campaigns from Claude, Cursor & any AI agent.
Files of Gambot MCP
gambot-ai/
Show the full text318 lines
Gambot — Official WhatsApp Business API for AI Agents (MCP + REST API)
Gambot gives AI agents and developers the official WhatsApp Business (Cloud) API — through a Model Context Protocol server and a REST API. Gambot is a Meta Business Solution Provider.
- Official API, not WhatsApp Web automation. No QR codes, no linked personal sessions, no headless browsers. Real business accounts, approved templates, Meta-backed delivery.
- Two ways to connect. Local:
npx -y gambot-mcp. Hosted:https://gambot-mcp.azurewebsites.net/mcp(Streamable HTTP, OAuth 2.0 or token). - Built for agents. Machine-readable states and errors (
error_code,can_recover,recommended_action,required_tool,template_required), one start-here tool (gambot_setup_whatsapp_integration), 24-hour-window and template guidance built in. - No account yet? Start anyway. The agent can create a Gambot account itself (no API key needed); the only human step is the Meta WhatsApp connection in a browser.
Using an AI coding agent? Install the Agent Skill, then ask: "Add the official WhatsApp API to this app."
npx skills add gambot-ai/gambot-mcp --skill gambot-whatsappThe skill (
skills/gambot-whatsapp) teaches the agent the whole path: account → Meta onboarding → auth → first message → templates → webhooks → error recovery.
Quick start
1. Add the MCP server (works in Claude Code, Claude Desktop, Cursor, Codex, Gemini CLI, VS Code/Copilot, Windsurf):
{
"mcpServers": {
"gambot": { "command": "npx", "args": ["-y", "gambot-mcp"] }
}
}
No token is needed to begin. Without GAMBOT_TOKEN the server runs in onboarding mode and creates your account.
| Client | Command / config |
|---|---|
| Claude Code | claude mcp add gambot -- npx -y gambot-mcp or hosted: claude mcp add --transport http gambot https://gambot-mcp.azurewebsites.net/mcp |
| Cursor | One-click install or .cursor/mcp.json |
| Claude Desktop | claude_desktop_config.json (JSON above) |
| OpenAI Codex | ~/.codex/config.toml → [mcp_servers.gambot] command = "npx" args = ["-y", "gambot-mcp"] |
| Gemini CLI | ~/.gemini/settings.json (JSON above) |
| VS Code / Copilot | .vscode/mcp.json → {"servers":{"gambot":{"type":"http","url":"https://gambot-mcp.azurewebsites.net/mcp"}}} |
| Windsurf | ~/.codeium/windsurf/mcp_config.json (JSON above) |
| ChatGPT | custom connector → https://gambot-mcp.azurewebsites.net/mcp (OAuth) |
Per-client guides: https://gambot.co.il/whatsapp-mcp/.
2. Ask your agent:
"Set up WhatsApp for my app with Gambot and send a test message to my number."
The agent calls gambot_setup_whatsapp_integration, which returns the current state and one next step — and tells it whether the agent or the human must do it:
| State | What happens |
|---|---|
no_account_known / account_missing |
Agent creates the account (gambot_create_trial_account, no API key) |
awaiting_whatsapp_connection |
Human opens the Meta Embedded Signup link in a browser (cannot run inside an agent) |
whatsapp_connected_needs_token |
Human signs in with OAuth (hosted MCP) or copies the token from Settings → General into GAMBOT_TOKEN |
ready_needs_template |
Agent creates a template (Meta approval) |
ready_to_send_first_message / ready |
Agent sends a test message and confirms delivery |
Authentication
Prefer OAuth (hosted MCP: https://gambot-mcp.azurewebsites.net/mcp — PKCE + dynamic client registration; no secret is pasted into config). Alternatively use your Gambot token (gmbt_…, Settings → General) as GAMBOT_TOKEN (local) or Authorization: Bearer gmbt_… (hosted / REST). Never paste a token into a chat. No account yet? https://gambot.co.il/OnboardingProcess/.
Minimal working example (REST, any language)
export GAMBOT_TOKEN=gmbt_... # from Settings → General; keep it secret
# Is free text allowed? (the 24-hour customer-service window)
curl -s https://api.gambot.co.il/api/v1/conversations/12025550123/window -H "Authorization: Bearer $GAMBOT_TOKEN"
# Window open → send text
curl -s -X POST https://api.gambot.co.il/api/v1/messages/send-text \
-H "Authorization: Bearer $GAMBOT_TOKEN" -H "Content-Type: application/json" \
-d '{"to":"12025550123","text":"Hello from Gambot"}'
# Window closed → send an approved template
curl -s -X POST https://api.gambot.co.il/api/v1/messages/send-template \
-H "Authorization: Bearer $GAMBOT_TOKEN" -H "Content-Type: application/json" \
-d '{"to":"12025550123","templateId":"hello_world_0626","variables":["there"]}'
Runnable examples (send message, send template, receive webhook, delivery status) for Node/TypeScript, Python, Next.js and Laravel/PHP: examples/.
Official API vs WhatsApp Web automation
| Gambot (official WhatsApp Business API) | WhatsApp Web / QR-session automation | |
|---|---|---|
| Architecture | Meta Cloud API via a Business Solution Provider | A browser or linked-device session driven by a script |
| Authentication | API token / OAuth, scoped per organization | A QR code scanned from a phone; session can expire |
| Meta relationship | Authorized provider, business-verified WABA | None |
| Production use | Designed for it | Fragile; sessions drop, accounts can be blocked |
| Business rules | 24-hour window, approved templates, opt-in, quality ratings | Not enforced, so easy to violate |
| Webhooks | Managed inbound events, delivery receipts | Depends on the library |
| Scaling | Messaging tiers, multiple numbers, campaigns | One linked phone |
Use the official API for anything customer-facing. More: https://gambot.co.il/whatsapp-mcp-vs-whatsapp-web/.
It wraps the public REST API at https://api.gambot.co.il/api/v1. MCP is an AI-facing interface over Gambot — it uses the same business logic as the REST API and is not a separate backend.
Why Gambot instead of building on Meta's Cloud API directly
Both Gambot and a do-it-yourself integration run on the same official WhatsApp Business (Cloud) API from Meta — Gambot is an authorized Meta Business Solution Provider (BSP), not a WhatsApp Web/unofficial workaround, and you keep your own number/WABA. The difference is how much infrastructure you build and maintain:
| What you need | Build on Meta Cloud API yourself | Gambot (this server) |
|---|---|---|
| Onboarding | Meta app review + Business verification, WABA setup | Guided onboarding, live in ~24–48h |
| Phone number | Register/migrate & manage via API | Connect/migrate from the dashboard (Coexistence supported) |
| Templates | Submit via API, track approval, version | Visual editor + approval status; gambot_list_templates |
| Webhooks | Host a public HTTPS endpoint (retries, dedupe, scale) | Managed inbound events; optional forwarding |
| Media | Upload/host media, manage ids/expiry | Handled in messages, templates & campaigns |
| 24h window | Track each conversation; choose free-text vs template | Enforced; API returns CONVERSATION_WINDOW_CLOSED + canSendTemplate |
| Tiers & limits | Track tiers, throttle, handle 131xxx errors | Handled; structured limit errors |
| Campaigns | Build queueing, segmentation, opt-out, reporting | Native campaigns with consent & per-recipient results |
| Automation / CRM | Build a bot engine & contact store | Bots, CRM, consent/opt-out & spam handling built in |
| AI agents | Parse raw Graph API errors (brittle) | Machine-readable states + MCP recommended next actions |
| API upkeep | Migrate as Meta bumps Graph versions | Gambot absorbs Meta API changes |
Net: same official API, none of the plumbing to build or maintain, compliance enforced for you, and it's agent-ready. Full comparison: https://gambot.co.il/whatsapp-api-vs-meta-cloud-api/.
Supported AI clients
Step‑by‑step setup guides per client:
- Cursor — one‑click install or
.cursor/mcp.json→ https://gambot.co.il/whatsapp-mcp/cursor/ - Claude — Claude Desktop (npx) or a remote connector → https://gambot.co.il/whatsapp-mcp/claude/
- ChatGPT — hosted connector (Streamable HTTP + OAuth) → https://gambot.co.il/whatsapp-mcp/chatgpt/
- Gemini — Gemini CLI settings → https://gambot.co.il/whatsapp-mcp/gemini/
Hosted (remote) server: https://gambot-mcp.azurewebsites.net/mcp (Streamable HTTP; OAuth or bearer token) — no local install needed.
Prerequisites
- Node.js 18+
- No account yet? You need nothing — start the server without a token and it runs in token‑less onboarding mode to create your Gambot account from scratch.
- Already have an account? A Gambot Token (
gmbt_…) from the Gambot admin panel → Settings → General, to unlock the full tool set.
Quick start (npx — recommended)
No clone or build is needed — MCP clients run it on demand with npx.
Cursor (.cursor/mcp.json) / Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"gambot": {
"command": "npx",
"args": ["-y", "gambot-mcp"],
"env": {
"GAMBOT_TOKEN": "gmbt_your_token_here"
}
}
}
}
Optional env var GAMBOT_API_BASE overrides the base URL (defaults to https://api.gambot.co.il/api/v1).
No token yet? Token‑less onboarding mode
You don't need a Gambot account to get started. The token is a result of finishing onboarding (chicken‑and‑egg: a brand‑new org has no token yet), so the server also runs without GAMBOT_TOKEN. Just omit it — leave env empty:
{
"mcpServers": {
"gambot": {
"command": "npx",
"args": ["-y", "gambot-mcp"]
}
}
}
Started token‑less, it enters onboarding mode and exposes only the public self‑serve tools — create a brand‑new account (free / co‑existence / bring‑your‑own number, or buy a number after e‑mail+WhatsApp verification), open the Meta Embedded Signup link in the browser, then poll gambot_get_onboarding_status until WhatsApp is connected. Just tell the agent "create a Gambot WhatsApp account for my business" and it walks you through it. Once connected, you get your gmbt_… token in‑app (Settings → General); add GAMBOT_TOKEN to the env above to unlock the full tool set. (Remote/OAuth clients like Claude & ChatGPT authorize per‑session through the hosted consent page instead.)
Local development (from source)
npm install
npm run build
Then point your MCP client at the built entrypoint:
{
"mcpServers": {
"gambot": {
"command": "node",
"args": ["C:/Users/you/source/repos/gambot/gmbt_mcp/dist/index.js"],
"env": {
"GAMBOT_TOKEN": "gmbt_your_token_here"
}
}
}
}
Tools
| Group | Tools |
|---|---|
| Start here | gambot_setup_whatsapp_integration (state + the single next step; works with or without a token) |
| Messages | gambot_send_text, gambot_send_template, gambot_get_message_status (delivery status by messageId) |
| Conversations | gambot_list_conversations (the conversation/contact LIST — who, with last-message metadata only), gambot_get_conversation_messages (full message history of ONE conversation), gambot_analytics_transcript (message CONTENT across ALL conversations for a period — for "how did my team reply today / which customers were upset"), gambot_check_window (is the 24h window open? → free text vs template), gambot_list_numbers (sender numbers for multi-number orgs) |
| Templates | gambot_list_templates, gambot_get_template, gambot_get_template_variables, gambot_create_template (text/media header, body variables, footer, buttons), gambot_upload_template_media |
| Contacts | gambot_get_contact_fields, gambot_create_contact, gambot_list_contacts (list/search the whole contacts directory — by name/phone/email, tag, conversation status/category or owner), gambot_get_contact, gambot_update_contact (base + customFields), gambot_list_ctwa_contacts (contacts created from a Click-to-WhatsApp ad, with the originating ad info), gambot_bulk_update_contacts (update MANY at once by filter/phones — tags, owner, category, consent, custom fields; preview → confirm and stamps an audit note) |
| Leads | gambot_get_lead_fields, gambot_create_lead, gambot_list_leads, gambot_get_lead, gambot_update_lead (all base fields + customFields), gambot_bulk_update_leads (update MANY at once by filter/ids — status/stage/owner/custom fields; preview → confirm and audited) |
| Cases | gambot_get_case_fields, gambot_create_case, gambot_list_cases, gambot_get_case, gambot_update_case (base + customFields) |
| Tasks | gambot_create_task, gambot_list_tasks, gambot_get_task, gambot_update_task |
| Notes | gambot_list_notes (read/search the notes across contacts, leads & cases — the in-app "Notes Hub"; filter by source/date/author/text), gambot_get_entity_notes (notes for one contact/lead/case — follows the org's "Sync Notes Between Entities" setting, so a contact also returns its leads'/cases' notes), gambot_add_note (write a timeline note on a contact/lead/case), gambot_update_note (edit an existing note) |
| Analytics / reports | gambot_analytics_summary (one-shot KPI snapshot: messages, contacts, leads, tickets, tasks, bots), gambot_analytics_messages, gambot_analytics_overview (lifetime + 6-month trend), gambot_analytics_daily_conversations (daily time series), gambot_analytics_contacts, gambot_analytics_leads, gambot_analytics_cases, gambot_analytics_tasks, gambot_analytics_ctwa, gambot_analytics_bots (bot/automation run performance + per-bot breakdown) |
| Quotes | gambot_create_quote, gambot_list_quotes, gambot_get_quote, gambot_update_quote |
| Invoices | gambot_create_invoice, gambot_list_invoices, gambot_get_invoice, gambot_update_invoice, gambot_issue_invoice |
| Orders | gambot_create_order, gambot_list_orders, gambot_get_order, gambot_update_order |
| Payments / transactions | gambot_list_transactions (payment/clearing transactions — "what did this customer pay/owe", filter by phone/status/entity), gambot_get_transaction (one transaction's full breakdown incl. VAT + items) |
| Signatures | gambot_list_signatures, gambot_get_signature, gambot_get_signature_link (signing link to distribute) |
| Web forms | gambot_list_forms, gambot_get_form, gambot_get_form_link (public link to distribute), gambot_get_form_submissions |
| Document templates | gambot_list_documents, gambot_get_document, gambot_create_document_link (distributable fill link), gambot_get_document_submissions |
| Users | gambot_create_user, gambot_list_users, gambot_get_user, gambot_update_user, gambot_enable_user, gambot_disable_user |
| Campaigns | gambot_list_campaigns, gambot_list_scheduled_campaigns, gambot_get_campaign, gambot_get_campaign_results, gambot_create_campaign (SAVED campaign — use for ANY scheduled send (once/recurring is always a campaign) or a reusable CRM-segment broadcast), gambot_send_campaign_from_excel (mail-merge blast from a sheet the user gave you — pass rows + phoneColumn + column→variable mapping; an Excel broadcast is always saved as a campaign — immediate = save + run now, scheduled = save + scheduler runs it), gambot_update_campaign, gambot_delete_campaign, gambot_run_campaign, gambot_send_campaign (immediate "run to a group": ad-hoc, unsaved send to a tag/segment/phone list), gambot_test_campaign (single recipient). Decision rule: group-run = immediate & unsaved (gambot_send_campaign); scheduled (once/recurring) = always a campaign (gambot_create_campaign); one-time Excel = always a campaign (gambot_send_campaign_from_excel). Prefer a template for broadcasts — a regular free-text broadcast only reaches recipients whose 24h window is open. Compliance is built in: every org has an ACTIVE opt-out flow (recipients reply הסר/stop/unsubscribe → excluded from future broadcasts); send/run responses echo it under optOut (enabled by default) and your consent under consent. |
| Bots & automations | gambot_deploy_bot_package (build a WHOLE bot in one call — main bot + activator + human-intervention cancel, linked as one package), gambot_list_bots, gambot_get_bot, gambot_get_bot_package (the whole bot: main + activator + human-intervention cancel + Gambot AI), gambot_create_keyword_autoreply, gambot_create_template_button_autoreply, gambot_create_menu_bot, gambot_create_bot (advanced, full step schema), gambot_create_facebook_lead_bot (auto-reply to new Facebook/Meta lead-form leads), gambot_set_bot_status (on/off; includePackage toggles the whole bot), gambot_delete_bot |
| Gambot AI (brain) | gambot_list_ai (the org's Gambot AI "brains" — purpose, tone, language, Q&A count), gambot_get_ai (one brain's full config), gambot_update_ai (PATCH — upgrade an existing brain; only the fields you pass change), gambot_create_ai (only if the org has none — check gambot_list_ai first) |
| Onboarding | gambot_check_organization, gambot_generate_organization_name, gambot_search_available_numbers (buy a number by country), gambot_send_onboarding_verification (6‑digit code to the customer's email + WhatsApp — required ONLY before creating an account that BUYS a number), gambot_verify_onboarding_code (verify that code), gambot_create_trial_account (free trial; free/coexistence/BYO/buy-a-SIM — buying a number needs a verified verificationId), gambot_create_paid_account (no trial, card required), gambot_add_payment_method (card on file), gambot_create_payment_link (Tranzila hosted), gambot_get_waba_connect_link, gambot_exchange_waba_token (complete Meta Embedded Signup), gambot_get_onboarding_status (poll until WhatsApp is connected) |
| Webhooks | gambot_register_webhook (register/update the URL Gambot POSTs events to — inbound messages, statuses, template updates; optional authHeader + per-event toggles), gambot_get_webhook (read current registration), gambot_test_webhook (fire a sample event and get the delivery result — verify your endpoint receives calls), gambot_delete_webhook (disable forwarding). For developers building a system that needs to receive messages/updates back in real time. |
| Connections | gambot_list_connections (the org's connected integrations — email & calendar OAuth, Facebook lead-ads pages, shop/CRM links, WhatsApp numbers; ids to use elsewhere) |
gambot_send_email (single email over a connected Google/Microsoft mailbox), gambot_list_email_campaigns, gambot_get_email_campaign, gambot_create_email_campaign (template or inline content; CRM segment or explicit recipients; run:true to send now), gambot_run_email_campaign (durable, resumable — safe for large lists, no duplicates) |
|
| Calendar | gambot_list_calendar_events (events in a date range from a connected Google/Microsoft calendar) |
| Facebook Lead Ads | gambot_list_facebook_lead_connections, gambot_list_facebook_lead_forms (leadgen forms of a connected page), gambot_create_facebook_lead_bot (auto-reply the moment a new lead arrives) |
Bots & automations model
A conversational bot in Gambot is usually a package of botomations that were deployed together and share a sourceFlowId. gambot_list_bots returns role, triggerKind, sourceFlowId and linkedBotomationId on every item so an agent can reconstruct it. The full package, in order, is:
- Main bot (
role: main_bot,isBot: true) — the conversation itself. Three flavours:- menu — an opening template whose quick-reply buttons route to replies.
- ai — a
GambotAistep that hands the conversation to Gambot AI (the AI operator). - combined — a menu where some branches route to Gambot AI.
- Activator / מפעיל (
role: activator) — the trigger that starts the bot.triggerKindtells you how it fires:incoming_message(keyword/any),template_button,campaign_lead(a lead arrived from an ad/campaign),owner_assigned(a contact was assigned to an owner — e.g. Gambot AI),scheduled, or inactivity re-engagement ("no message in X days"). - Human-intervention cancel / ביטול בוט בהתערבות אנושית (
role: human_intervention_cancel) — fires when a human agent sends a message and stops the running bot so it never talks over a human. One is seeded active per org; a package can deploy its own.
Gambot AI (the AI operator) = ownership. To route a contact to Gambot AI, assign the contact's owner to Gambot AI. The Gambot-AI botomation's trigger is contactOwner == the Gambot AI user, so it then answers with a GambotAi step. An activator can therefore do "if no communication in X days → assign the contact to Gambot AI", and the AI takes over.
Building a bot in one call. gambot_deploy_bot_package assembles the whole package for you, in order — (1) main bot, (2) activator, (3) human-intervention cancel — all sharing one sourceFlowId. Pick botType: "menu" (give openingTemplateName + options, and an activator that sends the opening template: keyword / any_message / inactivity / campaign_lead) or botType: "keyword" (self-activating — its keyword IS the activator, so no separate activator is created). AI/combined bots (Gambot AI) are built in the Bot Builder app because they need a Gambot AI configuration.
Turning a bot on/off: gambot_set_bot_status toggles one botomation; pass includePackage: true to turn the whole bot (main + activator + cancel + Gambot AI) on or off together. Use gambot_get_bot_package first to see exactly what will change.
Example prompts
- "Send a WhatsApp to +972 50‑123‑4567 saying their order shipped."
- "Message everyone tagged
VIPwith thepromo_launchtemplate." - "How many WhatsApp messages did we receive today, and how many are waiting for a reply?"
- "Summarize today's customer‑service conversations."
- "Schedule a campaign to the
newslettertag for tomorrow at 10:00." - "Build a lead bot: when a lead arrives from an ad, send the
welcome_leadtemplate with buttons Sales/Support, and stop if I jump in." →gambot_deploy_bot_package(botType: "menu", openingTemplateName: "welcome_lead", options: [...], activator: { type: "campaign_lead" }). - "Turn off my lead bot completely (the bot, its trigger and the AI answer)." →
gambot_get_bot_packagethengambot_set_bot_status(includePackage: true, status: "inactive"). - "Which bots are active, and what triggers each one?" →
gambot_list_bots(readrole+triggerKind).
Agent behavior, errors & recovery
Gambot MCP is designed so an AI agent can understand what happened and what to do next — it interprets the API's structured business state and returns actionable guidance.
Structured errors. On an API error the tool result is JSON with stable machine-readable fields an agent can act on without parsing prose:
error_code,reason,can_recover(can the agent fix it, or does a human have to?),recommended_action,required_tool(a real tool name),relevant_contact,template_required, plus the API's owndata. Example:{ "status": "action_required", "error_code": "CONVERSATION_WINDOW_CLOSED", "reason": "The 24-hour customer-service window is closed, so free text cannot be delivered. Send an approved template…", "can_recover": true, "recommended_action": "Call gambot_send_template. …", "required_tool": "gambot_send_template", "relevant_contact": "12025550123", "template_required": true, "data": { "canSendFreeText": false, "canSendTemplate": true } }(Legacy fields
code,messageandrecommendedActionare still returned for existing clients. Human-only problems such as a revoked token or missing billing returncan_recover: false.)Common recoveries.
CONVERSATION_WINDOW_CLOSED/TEMPLATE_REQUIRED→gambot_send_template;MISSING_TEMPLATE_VARIABLES→gambot_get_template_variables(then ask the user);CONTACT_NOT_FOUND→gambot_list_contacts(never guess a recipient);RATE_LIMITED/ messaging‑limit → back off, don't loop, use a campaign for bulk.Safety. The agent never silently picks an ambiguous recipient, and never loops single‑send tools for bulk — it's routed to campaigns.
Tool annotations. Read tools are marked read‑only/idempotent;
delete_*,disable_userandissue_invoiceare marked destructive; every tool isopenWorld(it talks to the live WhatsApp/Gambot backend). Use these to gate confirmations for external‑communication and high‑impact actions.
REST API & docs
- REST reference, auth, scopes and the full error‑code vocabulary: https://gambot.co.il/developers/
- WhatsApp API for AI agents: https://gambot.co.il/whatsapp-api-for-ai-agents/
Security
The Gambot Token is a secret (like a password). Keep it out of source control (use the client's env). You can rotate it any time from Gambot Settings → General, and optionally narrow its scopes there.
Publishing (maintainers)
This package ships with a server.json manifest for the official MCP Registry (registry.modelcontextprotocol.io). The registry only stores metadata, so the npm package must be published first, and the reverse‑DNS name in server.json must match mcpName in package.json (io.github.gambot-ai/gambot-mcp).
# 1) Publish the npm package (public)
npm publish --access public
# 2) Install the registry publisher CLI
# (see https://modelcontextprotocol.io/registry/quickstart)
brew install mcp-publisher # or download from the registry releases
# 3) Authenticate under the io.github.gambot-ai/* namespace and publish
mcp-publisher login github
mcp-publisher publish
If your GitHub owner is not
gambot-ai, update thenameinserver.json,mcpNameinpackage.json, and therepository/identifierfields to match before publishing.
Once listed in the official registry, aggregators such as Glama, PulseMCP and Smithery
index the server automatically. A smithery.yaml is also included for Smithery.
| 1 | # Gambot — Official WhatsApp Business API for AI Agents (MCP + REST API) |
| 2 | |
| 3 | [![npm]](https://www.npmjs.com/package/gambot-mcp) |
| 4 | [![MCP Registry]](https://registry.modelcontextprotocol.io) |
| 5 | [![Agent Skill]](./skills/gambot-whatsapp/SKILL.md) |
| 6 | [![License: MIT]](./LICENSE) |
| 7 | |
| 8 | **Gambot gives AI agents and developers the *official* WhatsApp Business (Cloud) API** — through a [Model Context Protocol] server and a REST API. Gambot is a Meta Business Solution Provider. |
| 9 | |
| 10 | **Official API, not WhatsApp Web automation.** No QR codes, no linked personal sessions, no headless browsers. Real business accounts, approved templates, Meta-backed delivery. |
| 11 | **Two ways to connect.** Local: `npx -y gambot-mcp`. Hosted: `https://gambot-mcp.azurewebsites.net/mcp` (Streamable HTTP, OAuth 2.0 or token). |
| 12 | **Built for agents.** Machine-readable states and errors (`error_code`, `can_recover`, `recommended_action`, `required_tool`, `template_required`), one start-here tool (`gambot_setup_whatsapp_integration`), 24-hour-window and template guidance built in. |
| 13 | **No account yet? Start anyway.** The agent can create a Gambot account itself (no API key needed); the only human step is the Meta WhatsApp connection in a browser. |
| 14 | |
| 15 | > **Using an AI coding agent?** Install the Agent Skill, then ask: *"Add the official WhatsApp API to this app."* |
| 16 | > ```bash |
| 17 | > npx skills add gambot-ai/gambot-mcp --skill gambot-whatsapp |
| 18 | > ``` |
| 19 | > The skill ([`skills/gambot-whatsapp`]) teaches the agent the whole path: account → Meta onboarding → auth → first message → templates → webhooks → error recovery. |
| 20 | |
| 21 | ## Quick start |
| 22 | |
| 23 | **1. Add the MCP server** (works in Claude Code, Claude Desktop, Cursor, Codex, Gemini CLI, VS Code/Copilot, Windsurf): |
| 24 | |
| 25 | |
| 26 | { |
| 27 | "mcpServers": { |
| 28 | "gambot": { "command": "npx", "args": ["-y", "gambot-mcp"] } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | |
| 33 | No token is needed to begin. Without `GAMBOT_TOKEN` the server runs in onboarding mode and creates your account. |
| 34 | |
| 35 | | Client | Command / config | |
| 36 | |---|---| |
| 37 | | Claude Code | `claude mcp add gambot -- npx -y gambot-mcp` or hosted: `claude mcp add --transport http gambot https://gambot-mcp.azurewebsites.net/mcp` | |
| 38 | | Cursor | [One-click install] or `.cursor/mcp.json` | |
| 39 | | Claude Desktop | `claude_desktop_config.json` (JSON above) | |
| 40 | | OpenAI Codex | `~/.codex/config.toml` → `[mcp_servers.gambot]` `command = "npx"` `args = ["-y", "gambot-mcp"]` | |
| 41 | | Gemini CLI | `~/.gemini/settings.json` (JSON above) | |
| 42 | | VS Code / Copilot | `.vscode/mcp.json` → `{"servers":{"gambot":{"type":"http","url":"https://gambot-mcp.azurewebsites.net/mcp"}}}` | |
| 43 | | Windsurf | `~/.codeium/windsurf/mcp_config.json` (JSON above) | |
| 44 | | ChatGPT | custom connector → `https://gambot-mcp.azurewebsites.net/mcp` (OAuth) | |
| 45 | |
| 46 | Per-client guides: <https://gambot.co.il/whatsapp-mcp/>. |
| 47 | |
| 48 | **2. Ask your agent:** |
| 49 | |
| 50 | > "Set up WhatsApp for my app with Gambot and send a test message to my number." |
| 51 | |
| 52 | The agent calls `gambot_setup_whatsapp_integration`, which returns the current state and **one** next step — and tells it whether the *agent* or the *human* must do it: |
| 53 | |
| 54 | | State | What happens | |
| 55 | |---|---| |
| 56 | | `no_account_known` / `account_missing` | Agent creates the account (`gambot_create_trial_account`, no API key) | |
| 57 | | `awaiting_whatsapp_connection` | **Human** opens the Meta Embedded Signup link in a browser (cannot run inside an agent) | |
| 58 | | `whatsapp_connected_needs_token` | **Human** signs in with OAuth (hosted MCP) or copies the token from *Settings → General* into `GAMBOT_TOKEN` | |
| 59 | | `ready_needs_template` | Agent creates a template (Meta approval) | |
| 60 | | `ready_to_send_first_message` / `ready` | Agent sends a test message and confirms delivery | |
| 61 | |
| 62 | ## Authentication |
| 63 | |
| 64 | Prefer **OAuth** (hosted MCP: `https://gambot-mcp.azurewebsites.net/mcp` — PKCE + dynamic client registration; no secret is pasted into config). Alternatively use your Gambot token (`gmbt_…`, *Settings → General*) as `GAMBOT_TOKEN` (local) or `Authorization: Bearer gmbt_…` (hosted / REST). Never paste a token into a chat. No account yet? <https://gambot.co.il/OnboardingProcess/>. |
| 65 | |
| 66 | ## Minimal working example (REST, any language) |
| 67 | |
| 68 | |
| 69 | export GAMBOT_TOKEN=gmbt_... # from Settings → General; keep it secret |
| 70 | |
| 71 | # Is free text allowed? (the 24-hour customer-service window) |
| 72 | curl -s https://api.gambot.co.il/api/v1/conversations/12025550123/window -H "Authorization: Bearer $GAMBOT_TOKEN" |
| 73 | |
| 74 | # Window open → send text |
| 75 | curl -s -X POST https://api.gambot.co.il/api/v1/messages/send-text \ |
| 76 | -H "Authorization: Bearer $GAMBOT_TOKEN" -H "Content-Type: application/json" \ |
| 77 | -d '{"to":"12025550123","text":"Hello from Gambot"}' |
| 78 | |
| 79 | # Window closed → send an approved template |
| 80 | curl -s -X POST https://api.gambot.co.il/api/v1/messages/send-template \ |
| 81 | -H "Authorization: Bearer $GAMBOT_TOKEN" -H "Content-Type: application/json" \ |
| 82 | -d '{"to":"12025550123","templateId":"hello_world_0626","variables":["there"]}' |
| 83 | |
| 84 | |
| 85 | Runnable examples (send message, send template, receive webhook, delivery status) for **Node/TypeScript, Python, Next.js and Laravel/PHP**: [`examples/`]. |
| 86 | |
| 87 | ## Official API vs WhatsApp Web automation |
| 88 | |
| 89 | | | Gambot (official WhatsApp Business API) | WhatsApp Web / QR-session automation | |
| 90 | |---|---|---| |
| 91 | | Architecture | Meta Cloud API via a Business Solution Provider | A browser or linked-device session driven by a script | |
| 92 | | Authentication | API token / OAuth, scoped per organization | A QR code scanned from a phone; session can expire | |
| 93 | | Meta relationship | Authorized provider, business-verified WABA | None | |
| 94 | | Production use | Designed for it | Fragile; sessions drop, accounts can be blocked | |
| 95 | | Business rules | 24-hour window, approved templates, opt-in, quality ratings | Not enforced, so easy to violate | |
| 96 | | Webhooks | Managed inbound events, delivery receipts | Depends on the library | |
| 97 | | Scaling | Messaging tiers, multiple numbers, campaigns | One linked phone | |
| 98 | |
| 99 | Use the official API for anything customer-facing. More: <https://gambot.co.il/whatsapp-mcp-vs-whatsapp-web/>. |
| 100 | |
| 101 | It wraps the public REST API at `https://api.gambot.co.il/api/v1`. MCP is an AI-facing **interface** over Gambot — it uses the same business logic as the REST API and is **not** a separate backend. |
| 102 | |
| 103 | ## Why Gambot instead of building on Meta's Cloud API directly |
| 104 | |
| 105 | Both Gambot and a do-it-yourself integration run on the **same official WhatsApp Business (Cloud) API** from Meta — Gambot is an authorized **Meta Business Solution Provider (BSP)**, not a WhatsApp Web/unofficial workaround, and you keep your own number/WABA. The difference is how much infrastructure you build and maintain: |
| 106 | |
| 107 | | What you need | Build on Meta Cloud API yourself | Gambot (this server) | |
| 108 | | --- | --- | --- | |
| 109 | | Onboarding | Meta app review + Business verification, WABA setup | Guided onboarding, live in ~24–48h | |
| 110 | | Phone number | Register/migrate & manage via API | Connect/migrate from the dashboard (Coexistence supported) | |
| 111 | | Templates | Submit via API, track approval, version | Visual editor + approval status; `gambot_list_templates` | |
| 112 | | Webhooks | Host a public HTTPS endpoint (retries, dedupe, scale) | Managed inbound events; optional forwarding | |
| 113 | | Media | Upload/host media, manage ids/expiry | Handled in messages, templates & campaigns | |
| 114 | | 24h window | Track each conversation; choose free-text vs template | Enforced; API returns `CONVERSATION_WINDOW_CLOSED` + `canSendTemplate` | |
| 115 | | Tiers & limits | Track tiers, throttle, handle 131xxx errors | Handled; structured limit errors | |
| 116 | | Campaigns | Build queueing, segmentation, opt-out, reporting | Native campaigns with consent & per-recipient results | |
| 117 | | Automation / CRM | Build a bot engine & contact store | Bots, CRM, consent/opt-out & spam handling built in | |
| 118 | | **AI agents** | Parse raw Graph API errors (brittle) | **Machine-readable states + MCP recommended next actions** | |
| 119 | | API upkeep | Migrate as Meta bumps Graph versions | Gambot absorbs Meta API changes | |
| 120 | |
| 121 | **Net:** same official API, none of the plumbing to build or maintain, compliance enforced for you, and it's agent-ready. Full comparison: <https://gambot.co.il/whatsapp-api-vs-meta-cloud-api/>. |
| 122 | |
| 123 | ## Supported AI clients |
| 124 | |
| 125 | Step‑by‑step setup guides per client: |
| 126 | |
| 127 | **Cursor** — one‑click install or `.cursor/mcp.json` → https://gambot.co.il/whatsapp-mcp/cursor/ |
| 128 | **Claude** — Claude Desktop (npx) or a remote connector → https://gambot.co.il/whatsapp-mcp/claude/ |
| 129 | **ChatGPT** — hosted connector (Streamable HTTP + OAuth) → https://gambot.co.il/whatsapp-mcp/chatgpt/ |
| 130 | **Gemini** — Gemini CLI settings → https://gambot.co.il/whatsapp-mcp/gemini/ |
| 131 | |
| 132 | **Hosted (remote) server:** `https://gambot-mcp.azurewebsites.net/mcp` (Streamable HTTP; OAuth or bearer token) — no local install needed. |
| 133 | |
| 134 | ## Prerequisites |
| 135 | |
| 136 | Node.js 18+ |
| 137 | **No account yet?** You need **nothing** — start the server *without* a token and it runs in [token‑less onboarding mode] to create your Gambot account from scratch. |
| 138 | **Already have an account?** A Gambot Token (`gmbt_…`) from the Gambot admin panel → **Settings → General**, to unlock the full tool set. |
| 139 | |
| 140 | ## Quick start (npx — recommended) |
| 141 | |
| 142 | No clone or build is needed — MCP clients run it on demand with `npx`. |
| 143 | |
| 144 | ### Cursor (`.cursor/mcp.json`) / Claude Desktop (`claude_desktop_config.json`) |
| 145 | |
| 146 | |
| 147 | { |
| 148 | "mcpServers": { |
| 149 | "gambot": { |
| 150 | "command": "npx", |
| 151 | "args": ["-y", "gambot-mcp"], |
| 152 | "env": { |
| 153 | "GAMBOT_TOKEN": "gmbt_your_token_here" |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | |
| 160 | Optional env var `GAMBOT_API_BASE` overrides the base URL (defaults to `https://api.gambot.co.il/api/v1`). |
| 161 | |
| 162 | ### No token yet? Token‑less onboarding mode |
| 163 | |
| 164 | **You don't need a Gambot account to get started.** The token is a **result** of finishing onboarding (chicken‑and‑egg: a brand‑new org has no token yet), so the server also runs **without** `GAMBOT_TOKEN`. Just omit it — leave `env` empty: |
| 165 | |
| 166 | |
| 167 | { |
| 168 | "mcpServers": { |
| 169 | "gambot": { |
| 170 | "command": "npx", |
| 171 | "args": ["-y", "gambot-mcp"] |
| 172 | } |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | |
| 177 | Started token‑less, it enters **onboarding mode** and exposes only the public self‑serve tools — create a brand‑new account (free / co‑existence / bring‑your‑own number, or buy a number after e‑mail+WhatsApp verification), open the Meta Embedded Signup link in the browser, then poll `gambot_get_onboarding_status` until WhatsApp is connected. Just tell the agent *"create a Gambot WhatsApp account for my business"* and it walks you through it. Once connected, you get your `gmbt_…` token in‑app (**Settings → General**); add `GAMBOT_TOKEN` to the `env` above to unlock the full tool set. (Remote/OAuth clients like Claude & ChatGPT authorize per‑session through the hosted consent page instead.) |
| 178 | |
| 179 | ## Local development (from source) |
| 180 | |
| 181 | |
| 182 | npm install |
| 183 | npm run build |
| 184 | |
| 185 | |
| 186 | Then point your MCP client at the built entrypoint: |
| 187 | |
| 188 | |
| 189 | { |
| 190 | "mcpServers": { |
| 191 | "gambot": { |
| 192 | "command": "node", |
| 193 | "args": ["C:/Users/you/source/repos/gambot/gmbt_mcp/dist/index.js"], |
| 194 | "env": { |
| 195 | "GAMBOT_TOKEN": "gmbt_your_token_here" |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | |
| 202 | ## Tools |
| 203 | |
| 204 | | Group | Tools | |
| 205 | |-------|-------| |
| 206 | | Start here | `gambot_setup_whatsapp_integration` (state + the single next step; works with or without a token) | |
| 207 | | Messages | `gambot_send_text`, `gambot_send_template`, `gambot_get_message_status` (delivery status by `messageId`) | |
| 208 | | Conversations | `gambot_list_conversations` (the conversation/contact LIST — who, with last-message metadata only), `gambot_get_conversation_messages` (full message history of ONE conversation), `gambot_analytics_transcript` (message CONTENT across ALL conversations for a period — for "how did my team reply today / which customers were upset"), `gambot_check_window` (is the 24h window open? → free text vs template), `gambot_list_numbers` (sender numbers for multi-number orgs) | |
| 209 | | Templates | `gambot_list_templates`, `gambot_get_template`, `gambot_get_template_variables`, `gambot_create_template` (text/media header, body variables, footer, buttons), `gambot_upload_template_media` | |
| 210 | | Contacts | `gambot_get_contact_fields`, `gambot_create_contact`, `gambot_list_contacts` (list/search the whole contacts directory — by name/phone/email, tag, conversation status/category or owner), `gambot_get_contact`, `gambot_update_contact` (base + `customFields`), `gambot_list_ctwa_contacts` (contacts created from a Click-to-WhatsApp ad, with the originating ad info), `gambot_bulk_update_contacts` (**update MANY at once** by filter/phones — tags, owner, category, consent, custom fields; **preview → confirm** and stamps an audit note) | |
| 211 | | Leads | `gambot_get_lead_fields`, `gambot_create_lead`, `gambot_list_leads`, `gambot_get_lead`, `gambot_update_lead` (all base fields + `customFields`), `gambot_bulk_update_leads` (**update MANY at once** by filter/ids — status/stage/owner/custom fields; **preview → confirm** and audited) | |
| 212 | | Cases | `gambot_get_case_fields`, `gambot_create_case`, `gambot_list_cases`, `gambot_get_case`, `gambot_update_case` (base + `customFields`) | |
| 213 | | Tasks | `gambot_create_task`, `gambot_list_tasks`, `gambot_get_task`, `gambot_update_task` | |
| 214 | | Notes | `gambot_list_notes` (read/search the notes across contacts, leads & cases — the in-app "Notes Hub"; filter by source/date/author/text), `gambot_get_entity_notes` (notes for one contact/lead/case — follows the org's "Sync Notes Between Entities" setting, so a contact also returns its leads'/cases' notes), `gambot_add_note` (**write** a timeline note on a contact/lead/case), `gambot_update_note` (**edit** an existing note) | |
| 215 | | Analytics / reports | `gambot_analytics_summary` (one-shot KPI snapshot: messages, contacts, leads, tickets, tasks, bots), `gambot_analytics_messages`, `gambot_analytics_overview` (lifetime + 6-month trend), `gambot_analytics_daily_conversations` (daily time series), `gambot_analytics_contacts`, `gambot_analytics_leads`, `gambot_analytics_cases`, `gambot_analytics_tasks`, `gambot_analytics_ctwa`, `gambot_analytics_bots` (bot/automation run performance + per-bot breakdown) | |
| 216 | | Quotes | `gambot_create_quote`, `gambot_list_quotes`, `gambot_get_quote`, `gambot_update_quote` | |
| 217 | | Invoices | `gambot_create_invoice`, `gambot_list_invoices`, `gambot_get_invoice`, `gambot_update_invoice`, `gambot_issue_invoice` | |
| 218 | | Orders | `gambot_create_order`, `gambot_list_orders`, `gambot_get_order`, `gambot_update_order` | |
| 219 | | Payments / transactions | `gambot_list_transactions` (payment/clearing transactions — "what did this customer pay/owe", filter by phone/status/entity), `gambot_get_transaction` (one transaction's full breakdown incl. VAT + items) | |
| 220 | | Signatures | `gambot_list_signatures`, `gambot_get_signature`, `gambot_get_signature_link` (signing link to distribute) | |
| 221 | | Web forms | `gambot_list_forms`, `gambot_get_form`, `gambot_get_form_link` (public link to distribute), `gambot_get_form_submissions` | |
| 222 | | Document templates | `gambot_list_documents`, `gambot_get_document`, `gambot_create_document_link` (distributable fill link), `gambot_get_document_submissions` | |
| 223 | | Users | `gambot_create_user`, `gambot_list_users`, `gambot_get_user`, `gambot_update_user`, `gambot_enable_user`, `gambot_disable_user` | |
| 224 | | Campaigns | `gambot_list_campaigns`, `gambot_list_scheduled_campaigns`, `gambot_get_campaign`, `gambot_get_campaign_results`, `gambot_create_campaign` (SAVED campaign — use for ANY scheduled send (once/recurring is always a campaign) or a reusable CRM-segment broadcast), `gambot_send_campaign_from_excel` (mail-merge blast from a sheet the user gave you — pass rows + phoneColumn + column→variable mapping; **an Excel broadcast is always saved as a campaign** — immediate = save + run now, scheduled = save + scheduler runs it), `gambot_update_campaign`, `gambot_delete_campaign`, `gambot_run_campaign`, `gambot_send_campaign` (immediate "run to a group": ad-hoc, unsaved send to a tag/segment/phone list), `gambot_test_campaign` (single recipient). **Decision rule:** group-run = immediate & unsaved (`gambot_send_campaign`); scheduled (once/recurring) = always a campaign (`gambot_create_campaign`); one-time Excel = always a campaign (`gambot_send_campaign_from_excel`). Prefer a **template** for broadcasts — a `regular` free-text broadcast only reaches recipients whose 24h window is open. **Compliance is built in:** every org has an ACTIVE opt-out flow (recipients reply `הסר`/`stop`/`unsubscribe` → excluded from future broadcasts); send/run responses echo it under `optOut` (enabled by default) and your consent under `consent`. | |
| 225 | | Bots & automations | `gambot_deploy_bot_package` (**build a WHOLE bot in one call** — main bot + activator + human-intervention cancel, linked as one package), `gambot_list_bots`, `gambot_get_bot`, `gambot_get_bot_package` (the whole bot: main + activator + human-intervention cancel + Gambot AI), `gambot_create_keyword_autoreply`, `gambot_create_template_button_autoreply`, `gambot_create_menu_bot`, `gambot_create_bot` (advanced, full step schema), `gambot_create_facebook_lead_bot` (auto-reply to new Facebook/Meta lead-form leads), `gambot_set_bot_status` (on/off; `includePackage` toggles the whole bot), `gambot_delete_bot` | |
| 226 | | Gambot AI (brain) | `gambot_list_ai` (the org's Gambot AI "brains" — purpose, tone, language, Q&A count), `gambot_get_ai` (one brain's full config), `gambot_update_ai` (PATCH — upgrade an existing brain; only the fields you pass change), `gambot_create_ai` (only if the org has none — check `gambot_list_ai` first) | |
| 227 | | Onboarding | `gambot_check_organization`, `gambot_generate_organization_name`, `gambot_search_available_numbers` (buy a number by country), `gambot_send_onboarding_verification` (6‑digit code to the customer's email + WhatsApp — required ONLY before creating an account that BUYS a number), `gambot_verify_onboarding_code` (verify that code), `gambot_create_trial_account` (free trial; free/coexistence/BYO/buy-a-SIM — buying a number needs a verified `verificationId`), `gambot_create_paid_account` (no trial, card required), `gambot_add_payment_method` (card on file), `gambot_create_payment_link` (Tranzila hosted), `gambot_get_waba_connect_link`, `gambot_exchange_waba_token` (complete Meta Embedded Signup), `gambot_get_onboarding_status` (poll until WhatsApp is connected) | |
| 228 | | Webhooks | `gambot_register_webhook` (register/update the URL Gambot POSTs events to — inbound messages, statuses, template updates; optional `authHeader` + per-event toggles), `gambot_get_webhook` (read current registration), `gambot_test_webhook` (fire a sample event and get the delivery result — verify your endpoint receives calls), `gambot_delete_webhook` (disable forwarding). For developers building a system that needs to **receive messages/updates back** in real time. | |
| 229 | | Connections | `gambot_list_connections` (the org's connected integrations — email & calendar OAuth, Facebook lead-ads pages, shop/CRM links, WhatsApp numbers; ids to use elsewhere) | |
| 230 | | Email | `gambot_send_email` (single email over a connected Google/Microsoft mailbox), `gambot_list_email_campaigns`, `gambot_get_email_campaign`, `gambot_create_email_campaign` (template or inline content; CRM segment or explicit recipients; `run:true` to send now), `gambot_run_email_campaign` (durable, resumable — safe for large lists, no duplicates) | |
| 231 | | Calendar | `gambot_list_calendar_events` (events in a date range from a connected Google/Microsoft calendar) | |
| 232 | | Facebook Lead Ads | `gambot_list_facebook_lead_connections`, `gambot_list_facebook_lead_forms` (leadgen forms of a connected page), `gambot_create_facebook_lead_bot` (auto-reply the moment a new lead arrives) | |
| 233 | |
| 234 | ### Bots & automations model |
| 235 | |
| 236 | A conversational bot in Gambot is usually a **package** of botomations that were deployed together and share a `sourceFlowId`. `gambot_list_bots` returns `role`, `triggerKind`, `sourceFlowId` and `linkedBotomationId` on every item so an agent can reconstruct it. The full package, **in order**, is: |
| 237 | |
| 238 | **Main bot** (`role: main_bot`, `isBot: true`) — the conversation itself. Three flavours: |
| 239 | **menu** — an opening template whose quick-reply buttons route to replies. |
| 240 | **ai** — a `GambotAi` step that hands the conversation to **Gambot AI** (the AI operator). |
| 241 | **combined** — a menu where some branches route to Gambot AI. |
| 242 | **Activator / מפעיל** (`role: activator`) — the **trigger** that starts the bot. `triggerKind` tells you how it fires: `incoming_message` (keyword/any), `template_button`, `campaign_lead` (a lead arrived from an ad/campaign), `owner_assigned` (a contact was assigned to an owner — e.g. Gambot AI), `scheduled`, or inactivity re-engagement ("no message in X days"). |
| 243 | **Human-intervention cancel / ביטול בוט בהתערבות אנושית** (`role: human_intervention_cancel`) — fires when a **human agent** sends a message and **stops the running bot** so it never talks over a human. One is seeded active per org; a package can deploy its own. |
| 244 | |
| 245 | **Gambot AI (the AI operator) = ownership.** To route a contact to Gambot AI, assign the contact's **owner** to *Gambot AI*. The Gambot-AI botomation's trigger is `contactOwner == the Gambot AI user`, so it then answers with a `GambotAi` step. An activator can therefore do "if no communication in X days → assign the contact to Gambot AI", and the AI takes over. |
| 246 | |
| 247 | **Building a bot in one call.** `gambot_deploy_bot_package` assembles the whole package for you, **in order** — (1) main bot, (2) activator, (3) human-intervention cancel — all sharing one `sourceFlowId`. Pick `botType: "menu"` (give `openingTemplateName` + `options`, and an `activator` that sends the opening template: `keyword` / `any_message` / `inactivity` / `campaign_lead`) or `botType: "keyword"` (self-activating — its keyword IS the activator, so no separate activator is created). AI/combined bots (Gambot AI) are built in the Bot Builder app because they need a Gambot AI configuration. |
| 248 | |
| 249 | **Turning a bot on/off:** `gambot_set_bot_status` toggles one botomation; pass `includePackage: true` to turn the **whole** bot (main + activator + cancel + Gambot AI) on or off together. Use `gambot_get_bot_package` first to see exactly what will change. |
| 250 | |
| 251 | ## Example prompts |
| 252 | |
| 253 | "Send a WhatsApp to +972 50‑123‑4567 saying their order shipped." |
| 254 | "Message everyone tagged `VIP` with the `promo_launch` template." |
| 255 | "How many WhatsApp messages did we receive today, and how many are waiting for a reply?" |
| 256 | "Summarize today's customer‑service conversations." |
| 257 | "Schedule a campaign to the `newsletter` tag for tomorrow at 10:00." |
| 258 | "Build a lead bot: when a lead arrives from an ad, send the `welcome_lead` template with buttons Sales/Support, and stop if I jump in." → `gambot_deploy_bot_package(botType: "menu", openingTemplateName: "welcome_lead", options: [...], activator: { type: "campaign_lead" })`. |
| 259 | "Turn off my lead bot completely (the bot, its trigger and the AI answer)." → `gambot_get_bot_package` then `gambot_set_bot_status(includePackage: true, status: "inactive")`. |
| 260 | "Which bots are active, and what triggers each one?" → `gambot_list_bots` (read `role` + `triggerKind`). |
| 261 | |
| 262 | ## Agent behavior, errors & recovery |
| 263 | |
| 264 | Gambot MCP is designed so an AI agent can **understand what happened and what to do next** — it interprets the API's structured business state and returns actionable guidance. |
| 265 | |
| 266 | **Structured errors.** On an API error the tool result is JSON with stable machine-readable fields an agent can act on without parsing prose: `error_code`, `reason`, `can_recover` (can the *agent* fix it, or does a *human* have to?), `recommended_action`, `required_tool` (a real tool name), `relevant_contact`, `template_required`, plus the API's own `data`. Example: |
| 267 | |
| 268 | |
| 269 | { |
| 270 | "status": "action_required", |
| 271 | "error_code": "CONVERSATION_WINDOW_CLOSED", |
| 272 | "reason": "The 24-hour customer-service window is closed, so free text cannot be delivered. Send an approved template…", |
| 273 | "can_recover": true, |
| 274 | "recommended_action": "Call gambot_send_template. …", |
| 275 | "required_tool": "gambot_send_template", |
| 276 | "relevant_contact": "12025550123", |
| 277 | "template_required": true, |
| 278 | "data": { "canSendFreeText": false, "canSendTemplate": true } |
| 279 | } |
| 280 | |
| 281 | |
| 282 | (Legacy fields `code`, `message` and `recommendedAction` are still returned for existing clients. Human-only problems such as a revoked token or missing billing return `can_recover: false`.) |
| 283 | **Common recoveries.** `CONVERSATION_WINDOW_CLOSED` / `TEMPLATE_REQUIRED` → `gambot_send_template`; `MISSING_TEMPLATE_VARIABLES` → `gambot_get_template_variables` (then ask the user); `CONTACT_NOT_FOUND` → `gambot_list_contacts` (never guess a recipient); `RATE_LIMITED` / messaging‑limit → back off, don't loop, use a campaign for bulk. |
| 284 | **Safety.** The agent never silently picks an ambiguous recipient, and never loops single‑send tools for bulk — it's routed to campaigns. |
| 285 | **Tool annotations.** Read tools are marked read‑only/idempotent; `delete_*`, `disable_user` and `issue_invoice` are marked destructive; every tool is `openWorld` (it talks to the live WhatsApp/Gambot backend). Use these to gate confirmations for external‑communication and high‑impact actions. |
| 286 | |
| 287 | ## REST API & docs |
| 288 | |
| 289 | REST reference, auth, scopes and the full error‑code vocabulary: https://gambot.co.il/developers/ |
| 290 | WhatsApp API for AI agents: https://gambot.co.il/whatsapp-api-for-ai-agents/ |
| 291 | |
| 292 | ## Security |
| 293 | |
| 294 | The Gambot Token is a secret (like a password). Keep it out of source control (use the client's `env`). You can rotate it any time from Gambot **Settings → General**, and optionally narrow its scopes there. |
| 295 | |
| 296 | ## Publishing (maintainers) |
| 297 | |
| 298 | This package ships with a [`server.json`] manifest for the **official MCP Registry** (`registry.modelcontextprotocol.io`). The registry only stores metadata, so the npm package must be published first, and the reverse‑DNS `name` in `server.json` must match `mcpName` in `package.json` (`io.github.gambot-ai/gambot-mcp`). |
| 299 | |
| 300 | |
| 301 | # 1) Publish the npm package (public) |
| 302 | npm publish --access public |
| 303 | |
| 304 | # 2) Install the registry publisher CLI |
| 305 | # (see https://modelcontextprotocol.io/registry/quickstart) |
| 306 | brew install mcp-publisher # or download from the registry releases |
| 307 | |
| 308 | # 3) Authenticate under the io.github.gambot-ai/* namespace and publish |
| 309 | mcp-publisher login github |
| 310 | mcp-publisher publish |
| 311 | |
| 312 | |
| 313 | > If your GitHub owner is not `gambot-ai`, update the `name` in `server.json`, `mcpName` in |
| 314 | > `package.json`, and the `repository`/`identifier` fields to match before publishing. |
| 315 | |
| 316 | Once listed in the official registry, aggregators such as **Glama**, **PulseMCP** and **Smithery** |
| 317 | index the server automatically. A [`smithery.yaml`] is also included for Smithery. |
| 318 |
Discussion
Alternatives
Browse more free AI agents or everything in Development.