WhatsApp AI Gateway: 8 Self-Hosted Options Compared

Table of Contents

A WhatsApp AI gateway is a server component that connects a WhatsApp number to an HTTP interface, so an AI agent can receive incoming messages as webhooks and send replies through REST calls. The gateway owns session state, media handling, delivery queues and retries, sitting between WhatsApp’s own protocol and the agent logic above it.

1. Evolution API: the broadest open-source gateway

Evolution API: the broadest open-source gateway

Evolution API is an open-source REST API for WhatsApp and multi-channel messaging, maintained as part of the Evolution Foundation ecosystem. It began as a WhatsApp controller based on CodeChat, which implemented the Baileys library, and has since grown to cover both the Baileys-based WhatsApp Web route and the official WhatsApp Cloud API behind the same interface.

That dual support is why it opens this list. Most gateways commit to one protocol route, which means the day a project outgrows an unlinked device and needs an approved business number, the integration gets rewritten. Evolution API lets that migration happen behind a stable API surface instead of in your agent code.

For agent work, the integration list matters more than the message-sending endpoints, which every gateway has. Evolution API ships connections to Typebot, Chatwoot, Dify and OpenAI, alongside RabbitMQ, Apache Kafka, Amazon SQS and Socket.io for event delivery and S3 or MinIO for media. The queue options are the useful part: an agent that thinks for several seconds should not be holding a webhook open, and a broker between the gateway and the agent is how you avoid that.

It is also the busiest project of the group by contributors and community activity, which cuts both ways. Questions get answered and the protocol work keeps pace with WhatsApp changes, but the surface area is large and the open issue count reflects a project carrying many integrations at once. If you want one gateway that will probably still fit in a year, this is the safe default.

2. WAHA: one HTTP API, three engines

WAHA: one HTTP API, three engines

WAHA presents WhatsApp as a plain HTTP API and is distributed under Apache 2.0. Its distinguishing design decision is engine choice: WEBJS drives a real browser session, NOWEB talks the multi-device websocket protocol from Node, and GOWS does the same from Go. All three sit behind the same REST calls.

That matters because the engine decides the resource profile and the failure modes, not the API you write against. A browser-backed session behaves most like a genuine WhatsApp Web client and tends to be the most forgiving on protocol edge cases, at the cost of running a headless browser per session. The websocket engines are far lighter and pack more numbers onto one box, which is what you want when a single agent serves many numbers.

Being able to switch engines without touching your agent is a real operational hedge. When a protocol change breaks one engine, the others usually keep working, and a configuration change is a much better incident response than a rewrite.

WAHA is the oldest project here by some margin, with development going back to 2020, and that longevity shows in the documentation and the breadth of its Python and Node examples. It is aimed squarely at developers who want messaging as an HTTP dependency, in the same way the Telegram AI bot platforms treat the Bot API as a transport and leave the intelligence to whatever sits behind it.

3. OpenWA: MIT gateway with swappable storage

OpenWA: MIT gateway with swappable storage

OpenWA is an open-source, self-hosted WhatsApp API gateway that wraps a WhatsApp connection in a REST API for sending and receiving messages, managing groups and contacts, and reacting to events. The project states its position directly: the complete codebase is MIT licensed, with no paid tier and no feature gates.

Its design centres on pluggable adapters configured through environment variables. The database can be SQLite or PostgreSQL, media storage can be the local filesystem or S3 and MinIO, and the cache can be Redis or absent entirely. No code changes are involved in any of those swaps.

That flexibility is more useful than it first appears for agent deployments. A single-number prototype can run on SQLite with local media and no Redis, then the same image moves to Postgres and object storage when the agent starts serving real volume. The gateway stops being the thing you rebuild at every stage.

It also ships a bundled React dashboard for sessions, webhooks and API keys, served by the API on the same port, and delivers message and session events as HMAC-signed webhooks so the receiving agent can verify provenance. Signature verification deserves more attention than it usually gets: a webhook endpoint that accepts unauthenticated posts is a direct injection path into whatever the agent is allowed to do.

4. SetupYourClaw: managed deployment when the session must stay up

SetupYourClaw: managed deployment when the session must stay up

SetupYourClaw is a managed AI agent deployment service, where the agent runs and stays connected to its channels without the customer provisioning or maintaining the server underneath. On the WhatsApp side that means the gateway process, the session store and the reconnect behaviour are somebody else’s operational problem.

The reason this belongs in a gateway comparison rather than beside it is that choosing a gateway is the easy decision, and the published issue trackers show where the hard part lives. Baileys-based deployments report aggressive session rotation that triggers decrypt errors and duplicate processing, continuous socket timeouts, and reconnect storms when disconnect reasons are mishandled. None of that is exotic; it is the normal texture of running an unofficial WhatsApp session in production, and it arrives at the worst possible moments.

So the honest framing is a trade, not an upgrade. Managed deployment makes sense when the agent’s behaviour is the product and the session plumbing is pure overhead, or when a dead session on a Saturday afternoon means lost bookings. Self-hosting is the better call if you already run monitored infrastructure and have somebody on call, or if message data must stay on hardware you control for compliance reasons.

The test worth applying is the week-three test, the same one that separates the self-hosted AI agent platforms from the managed ones: when the session drops at 3am or a dependency upgrade breaks pairing, whose evening does that become?

5. wakit API: multi-tenant platform on the official API

wakit API: multi-tenant platform on the official API

wakit API, previously named OpenBSP, is an open-source WhatsApp Business platform built on Deno and PostgreSQL with Supabase, and it takes the opposite protocol position to most of this list. It connects to the official WhatsApp API rather than emulating a linked device, and the project describes itself as self-hostable, multi-tenant and AI-agent ready.

The multi-tenancy is the real differentiator. The platform is designed both for a single business managing its own messaging and for service providers managing messaging on behalf of other organisations, with native support for multiple tenants and a path toward becoming a Meta Business Partner. It also supports connecting existing WhatsApp Business accounts through Embedded Signup, described as coexistence.

For an agency running agents on client-owned numbers, that shape fits better than a single-tenant gateway replicated per customer. Each client keeps their own WhatsApp Business Account and their own number, while the agent infrastructure and the conversation store stay consolidated.

Messages land in a Supabase-backed database, which gives the agent a queryable conversation history without building a separate store. A companion project, wakit UI, provides a React and Tailwind web interface for managing conversations, which matters because the official route needs a human inbox for the cases the agent should not answer. The project notes it is backed by Mirlo and currently rebranding.

6. WaSphere: security-first multi-session gateway

WaSphere: security-first multi-session gateway

WaSphere is an MIT-licensed, self-hosted WhatsApp API platform built on NestJS and Baileys, aimed at developers, hosting and WHMCS resellers, and billing systems that want a gateway they fully own. Its pitch is ownership of the deployment and the data, with no managed SaaS in the path.

What sets it apart from the other Baileys-based options is how much of its feature list is security rather than messaging. Webhooks are HMAC-signed, API keys are scoped, webhook delivery is SSRF-guarded, and stored secrets are encrypted. The bundled Next.js dashboard covers sessions, webhooks, API keys and messaging, with an audit log alongside them.

Those specifics are worth pausing on for agent deployments. SSRF-guarded delivery means the gateway will not be talked into fetching internal addresses on your behalf, scoped keys let a read-only component exist without send permissions, and an audit log answers the question that comes up after any incident, which is what the agent actually did and when.

The trade is maturity. This is a young project with a small contributor base, so you are adopting a codebase you may end up reading rather than one with years of community answers behind it. For teams that would audit a gateway before trusting it with customer conversations anyway, that is a smaller objection than it sounds, and multi-session plus multi-webhook support covers the usual reseller shape.

7. MultiWA: multi-engine gateway with an admin dashboard

MultiWA: multi-engine gateway with an admin dashboard

MultiWA is an MIT-licensed, self-hosted WhatsApp Business API gateway that connects multiple WhatsApp numbers through a single unified REST and WebSocket API. It runs as a Docker Compose stack and describes itself as multi-engine, so the underlying connection library is a configuration choice rather than a fixed dependency.

The WebSocket half of the API is the detail worth noticing. Webhooks are a fine way to hand a message to an agent that replies and stops, but a persistent socket is a better fit when something needs a live view of the conversation, such as a dashboard showing a human what the agent is currently handling.

It ships an admin dashboard for QR onboarding and live chat, plus official SDKs. QR onboarding sounds mundane until you have walked a non-technical client through pairing a number over a video call; having a hosted page for it removes a genuinely awkward step from every new deployment.

The live chat view supports the pattern most deployments end up needing, where the agent answers routine questions and a person takes over the rest. That hand-off is the same design problem as the approval gates an unattended agent needs elsewhere: the agent should be allowed to act on its own only where a mistake is cheap. Like WaSphere, MultiWA is a recent project with a small community.

8. Relay WhatsApp AI Gateway: agent-first middleware

Relay WhatsApp AI Gateway: agent-first middleware

Relay WhatsApp AI Gateway describes itself as self-hosted WhatsApp middleware for AI agents, n8n and custom webhooks, built on Next.js, TypeScript, Baileys and SQLite, with Redis and BullMQ and S3-compatible storage as optional components. It is the only project here designed around the agent rather than around the transport.

That shows in what comes built in. The gateway can call OpenAI, Anthropic or a custom webhook agent directly, with per-contact memory, and it handles voice transcription, image analysis and PDF extraction before the model sees anything. Multimodal normalisation is work every WhatsApp agent needs, because real customers send voice notes and photographs of documents rather than clean text.

The operational features are unusually complete for a young project: durable outbound, command and webhook queues using BullMQ when configured and SQLite polling otherwise, signed webhook delivery history with retries, dead-letter status and replay, Baileys credentials encrypted with AES-256-GCM, Prometheus metrics with a Grafana dashboard, and structured logs. Webhook replay in particular is the feature you want at 9am after an overnight outage.

It also covers the business layer with contacts, tags, assignment, consent and opt-out, templates and auto-reply rules, plus organisations, roles, hashed API keys with scopes and IP allowlists. Consent handling is not decoration on WhatsApp. The honest caveat is that this is the newest and least proven project on the list.

Self-hosted WhatsApp gateways at a glance

Gateway Protocol route Stack Best for
Evolution API Baileys or Cloud API TypeScript, Docker A default that survives a migration
WAHA Three engines, unofficial Node and Go, Docker Swapping engines without a rewrite
OpenWA Unofficial WhatsApp Web Node, pluggable adapters Growing from prototype to production
SetupYourClaw Managed for you Managed deployment Agents where uptime is the product
wakit API Official WhatsApp API Deno, Postgres, Supabase Agencies with many client numbers
WaSphere Baileys NestJS, Next.js dashboard Teams that audit before trusting
MultiWA Multi-engine, unofficial Docker Compose, REST plus WebSocket Client onboarding and human hand-off
Relay Baileys Next.js, SQLite, optional Redis Agent features already included

How to choose

Decide the protocol route before comparing features, because it is the only choice that is expensive to reverse. The official WhatsApp API means business verification, an approved number and template rules, and it is the route that will not get the number banned; the unofficial libraries pair a normal account in minutes and carry a documented ban risk that the gateway cannot remove. Pick official for anything a client depends on, unofficial for internal tools and prototypes. Only then compare gateways, and weigh them on queueing, signed webhooks and session recovery rather than on how many message types they list. Finally, be honest about who answers when the session drops, because that answer decides whether self-hosting is cheaper than managed.

Frequently asked questions

What is a WhatsApp AI gateway?

A WhatsApp AI gateway is the server layer that turns a WhatsApp connection into an HTTP interface an AI agent can use. Incoming messages arrive at the agent as webhooks or socket events, replies go out through REST calls, and the gateway handles sessions, media and delivery retries so the agent only deals with conversation.

Do I need the official WhatsApp API or can I use Baileys?

Both work technically, but the risk differs sharply. Baileys emulates a linked device, which pairs quickly and needs no approval, and public discussions on the project record accounts banned at connect time. The official route requires business verification and template approval. For anything a customer relies on, choose the official API.

Can one gateway handle several WhatsApp numbers?

Most of these gateways support multiple concurrent sessions on one instance, which is the normal shape for an agency running agents for several clients. The practical limit is resources rather than licensing, and it depends heavily on the engine, since a browser-backed session costs far more per number than a websocket one.

What breaks most often in a self-hosted WhatsApp gateway?

The session, not the code. Public issue trackers describe socket timeouts, aggressive session rotation causing decrypt failures, and reconnect storms after mishandled disconnect reasons. The agent keeps running while messages silently stop arriving, which is the dangerous failure because nothing errors loudly. Health checks on the session itself are essential.

Does the gateway choice affect what the AI agent can do?

Less than people expect. Any gateway that delivers inbound messages and accepts outbound ones supports the same agent behaviour. What changes is the surrounding work: whether multimodal input arrives transcribed, whether a broker sits between gateway and agent, and whether a human can take over a conversation mid-flow.

Conclusion

The self-hosted WhatsApp AI gateway options here differ far less in what they can send than in the operational commitment they ask for. Evolution API and WAHA are the mature defaults, OpenWA and WaSphere suit teams who want to read the code they depend on, wakit API fits agencies on the official route, and Relay bundles the most agent-specific work. All of them leave you owning the session. If the goal is an agent answering on WhatsApp without taking on server provisioning, session monitoring and reconnect debugging, SetupYourClaw runs that half for you.