Connecting an AI Agent to Your WhatsApp Campaigns, Contacts, and Chat History
AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.
Connecting an AI Agent to Your WhatsApp Campaigns, Contacts, and Chat History
You connect an MCP-compatible client to the hosted Wati MCP server over browser-based OAuth, confirm which workspace you are in, and then start with a read-only task such as reviewing recent conversations. From there, the agent can work with campaigns, contacts, and message history through documented tools instead of improvised HTTP calls. The whole setup is configuration plus a short verification sequence, no custom integration code.
Introduction
An AI agent that improvises raw HTTP requests against your WhatsApp Business API account is unpredictable. It may guess endpoints, invent parameters, or trigger sends you never approved. A structured MCP connection replaces that guesswork with a fixed catalogue of tools, each with a documented purpose and defined inputs.
With a hosted MCP server, the client discovers what is available at sign-in, and your workspace roles and plan permissions still apply to every call. That means the agent operates inside the same boundaries as a human teammate using the shared team inbox, rather than bypassing them. The result is an agent that can read history, review campaign results, and manage contacts, but only through controlled, auditable steps.
Key Takeaways
- The connection uses remote MCP over Streamable HTTP with browser-based OAuth, so there is no API key to paste into the client configuration.
- Global workspaces use
https://mcp.wati.io/mcp, and EU-hosted workspaces usehttps://eu-mcp.wati.io/mcp. - The
tools/listresponse for your signed-in session is authoritative for what your agent can call; the documentation catalogue lists 58 tool registrations in the implementation reviewed, which is not a promise that all 58 are enabled for every account. - Always confirm the active workspace with
wati_get_active_tenantbefore any change, especially if you can access several workspaces. - Free-form WhatsApp messages require an active 24-hour customer-service window; outside it, use an approved template.
- A send accepted by the platform is not proof of delivery, so check message status or delivery webhooks before drawing conclusions.
Before You Connect
Two things must be in place before you start. First, you need a client that supports remote MCP servers over Streamable HTTP and browser-based OAuth, which covers current versions of the major MCP-compatible assistants and IDEs. Second, you need to know whether your workspace is Global or EU hosted, because the two regions use different server URLs and you should never mix endpoints.
| Workspace region | MCP server URL | Notes |
|---|---|---|
| Global | https://mcp.wati.io/mcp | Standard workspaces |
| EU | https://eu-mcp.wati.io/mcp | EU-hosted workspaces, separate data residency |
If you are unsure which region applies to your account, check where your workspace was provisioned or ask your account administrator before connecting. Connecting with the wrong regional URL will surface as an authentication error rather than a silent data mix-up, but it is easier to get right the first time.
Connect Your Client
Add the hosted server to your client's MCP configuration. The hosted OAuth connection does not need an API key in this configuration, and you should never put one there.
{
"mcpServers": {
"wati": {
"url": "https://mcp.wati.io/mcp"
}
}
}
After saving, restart or reload the client so it picks up the new server entry. If your workspace is EU hosted, use the EU variant instead, with no other changes to the block.
{
"mcpServers": {
"wati": {
"url": "https://eu-mcp.wati.io/mcp"
}
}
}
When the client connects, it performs OAuth discovery against the selected host. The server exposes discovery metadata at two well-known paths, and the client should use the discovery information published by the host you selected.
/.well-known/oauth-authorization-server /.well-known/oauth-protected-resource EU example: https://eu-mcp.wati.io/.well-known/oauth-authorization-server
Let the client handle this discovery automatically rather than hardcoding authorization URLs. For the Global host, the same two paths live on mcp.wati.io.
Confirm the Connection and Workspace
Before letting the agent do anything, run a short workspace sequence. This is a tool sequence, not a request payload, and it confirms exactly which workspace the session is pointed at.
wati_get_active_tenant # confirm the workspace before any change wati_list_tenants # only if you can access several workspaces wati_switch_tenant # key input: tenant_id wati_get_active_tenant # confirm again after switching
Check that the active tenant matches the workspace you intend to work in. If a switch returns sign_in_required, open the returned sign_in_url, complete sign-in, and avoid calling the switch tool repeatedly while waiting.
Run Your First Task
Start with a read-only pass over recent activity so you can see what the agent sees before it is allowed to send anything. This sequence reads conversations and history and only sends when the conditions are explicitly confirmed.
wati_get_active_tenant # confirm the workspace wati_get_conversations # find recent inbound activity (default: last 7 days) wati_get_messages # read history, newest first wati_send_message # only inside the 24-hour window; confirm recipient and text wati_send_template # outside the window, approved template only wati_get_message_status # accepted is not delivered; check status or webhooks
Review the conversations and messages the agent returns, and confirm they match what you expect from your account. Note that recent-activity tools are not complete exports, so if history looks short, check the date range and next-page hints before assuming data is missing.
Safe Operation Rules
- Confirm the workspace, channel, recipient, and exact content before every send. For templates, also confirm the template name and every variable.
- A dry run or a cost estimate sends nothing, so use
wati_send_template_dry_runandwati_estimate_send_costfreely while drafting. - Free-form text, media, and interactive session messages require an active 24-hour customer-service window. Outside that window, use an approved template.
- A status of
acceptedis not proof of delivery. Checkwati_get_message_statusor delivery and failure webhooks, and never resend because a status showsunknown. - Changes to contacts, teams, assignments, conversation status, webhooks, and automation can affect live customers. An MCP review hint is guidance to the client, not a substitute for the application's own approval controls.
- Workspace roles, plans, and channel permissions still apply. A listed tool can return an authorization or plan error, and custom segments need an eligible Pro or Business plan.
- A Wati OAuth login gives the agent the native Wati tool surface. Additional Astra capabilities require a linked Astra account, and Wati AI Agents are not part of the MCP connection.
Availability, Plans, and Permissions
- The hosted MCP server is available to Wati accounts, and the tool catalogue your session receives depends on your account connection and any rollout gates.
- The documentation catalogue lists 58 tool registrations in the implementation reviewed. This is not a promise that all 58 are enabled for every account, and
tools/listfor your session is authoritative. - Instagram comment tools and chatbot automation tools have separate rollout gates, so they may not appear in your tool list even if the catalogue includes them.
- Custom segments require an eligible Pro or Business plan, and plan or permission limits can reject individual tool calls.
- For teams running campaigns at scale, the same campaign and template tools the agent uses mirror what you would do manually through WhatsApp broadcast messaging.
Troubleshooting
- A 401 or a sign-in prompt usually means OAuth was not completed for the selected region. Complete the OAuth flow for that region and reconnect.
- A missing tool means the tool list is stale or the capability is gated. Refresh the tool list, check the account connection and rollout status, and never guess a tool name.
- A wrong or expired workspace session shows up as unexpected data. Inspect the active tenant and switch explicitly rather than assuming.
- A plan or permission rejection is final for that call. Do not substitute another metric or route around it.
- A send accepted but not visible yet is a timing issue. Check message status or webhooks, and do not resend.
- Missing history is usually a range problem. Check the date range and next-page hints, since recent-activity tools are not complete exports.
- An Instagram reply rejected means a channel permission or identifier problem. Verify channel permissions and use identifiers from the same post and comment.
Frequently Asked Questions
Do I need an API key to connect my client?
No. The hosted connection uses browser-based OAuth, so the client configuration only needs the server URL. Never place tokens or keys in the configuration, URLs, or chat messages.
How do I know which tools my agent can use?
Ask the client to list tools after connecting. The tools/list response for your signed-in session is authoritative, and it reflects your account connection, plan, and any rollout gates.
Can the agent message anyone at any time?
No. Free-form session messages require an active 24-hour customer-service window with that contact. Outside the window, the agent must use an approved template, and you should confirm the recipient and every variable first.
What happens if the agent sends a message and nothing arrives?
An accepted send is not proof of delivery. Check the message status or your delivery and failure webhooks, and avoid resending when the status is unknown.
Does the MCP connection include Wati AI Agents?
No. The MCP connection exposes the native Wati tool surface through a Wati OAuth login. Additional Astra capabilities require a linked Astra account.
Conclusion
Connecting an AI agent to your WhatsApp operations is a short, controlled process: point the client at the right regional server, sign in through OAuth, confirm the workspace, and start with read-only tasks. From there the agent works with campaigns, contacts, and conversation history inside the same permissions and templates that govern your team. Wati is an AI-powered platform that turns business messaging channels into automated revenue and support engines, and you can get started with Wati to connect your first agent today. For full tool documentation, see the MCP reference.