How to Build a WhatsApp AI Agent in 2026 (Hosted or Your Own API)
A practical build guide: get a WhatsApp number, decide whether Wabery hosts the agent or your own backend answers, test it in a sandbox before any Meta setup, then go live without breaking anything.
Short version for agencies: WhatsApp AI agent page. It compares the fastest sandbox-to-client-WABA path and the products built for different buyers.
Most WhatsApp AI agent tutorials skip the two decisions that actually determine whether the thing survives contact with customers: who writes the replies, and what happens the day you need to change the agent while it is already answering people.
This guide covers the whole build. Both paths, hosted and your own API, plus the WhatsApp-specific parts that are not optional and are not obvious.
Full disclosure: this is written by the team behind Wabery, and the steps use it. The concepts transfer to any official provider. The parts we do not have are marked as such.
What You Are Actually Building
A WhatsApp AI agent is four moving pieces:
- A WhatsApp Business number on Meta’s official Cloud API, with a WhatsApp Business Account (WABA) behind it.
- A receive path. Inbound messages arrive as webhooks.
- A decision layer. Something reads the message, holds conversation state, calls tools, and writes a reply.
- A send path. The reply goes back out inside WhatsApp’s rules.
Every tutorial covers 1 and 4. The interesting decision is 3, and the expensive mistake is ignoring the rules attached to 4.
Step 1: Skip the Meta Setup for Now
The single most common way a WhatsApp agent project dies is spending week one in Meta Business Manager: business verification, display-name review, a test number that only messages five hand-added recipients. You have not written a line of agent logic and you already need someone’s tax documents.
Do not start there. Start on a sandbox.
On Wabery, every project begins on a shared WhatsApp sandbox number. Create a project, copy a join code that looks like wab-ABC123, text it from your own phone, then send a normal message. That message creates a real conversation in the WhatsApp app with no Meta account or business number. Sandbox delivery is free through September 30, 2026; from October 1 it uses wallet credit at Meta’s published destination-market service rate, without markup. The $2 starter credit is allocated after you add a card.
You → sandbox number: wab-ABC123You → sandbox number: hi, do you take walk-ins on saturday?Agent → you: We do, until 4pm. Want me to hold a slot?That thread is what you show a stakeholder or a client. A 200 response in Postman is not.
You move to a real number later, once the agent is worth putting on one. Sandbox docs.
Step 2: Decide Who Writes the Replies
This is the fork in the road. Wabery asks it during onboarding, in one question, because it changes everything downstream.
Path A: Hosted agent
Wabery runs the agent. You never deploy anything.
Choose this when the agent’s job is describable in a paragraph: answer questions, collect a few fields, escalate when it should not guess. Which is most of them, honestly.
Path B: Your own backend
You already have the brains. n8n, Make, Zapier, a Python service, a LangGraph app, an OpenAI or Anthropic loop you have tuned for months. Wabery is the WhatsApp connection under it.
Choose this when the agent needs your data, your models, your prompt versioning, or your compliance boundary.
Path C: Both
Nothing stops you starting hosted to prove the shape of the conversation, then switching to your backend once the logic outgrows a description. It is a project setting, not a migration to a different vendor.
Getting started: choose who writes the replies.
Step 3A: Build the Hosted Agent
Say what it should do
Wabery asks for the job, not a pile of settings. Be concrete:
Answer questions for a dental clinic, collect the treatment and preferred date, and hand off emergencies or anything about billing.
“Be a helpful assistant” is not a spec. Say what success looks like and, more importantly, say when a human should take over. That second half is the one people forget and then regret.
Give it facts
Import a website, paste client details, or upload text, Markdown or CSV. Good knowledge is the boring stuff:
- services and prices
- opening hours and locations
- booking, refund and cancellation rules
- the answers your team retypes every day
- what the agent must never guess
That last line is the one that saves you. An agent that says “I don’t have that, let me get someone” is worth ten that improvise a price.
Test the Draft on your phone
Wabery builds a Draft and prepares its sandbox tools. Join the sandbox, then send real customer-style questions. Include the awkward ones. Ask something deliberately missing from the knowledge. Try to trigger a handoff. Check that it stays short, because WhatsApp is a chat and nobody reads four paragraphs on a phone.
Step 3B: Connect Your Own Backend
The shape is three arrows:
WhatsApp → signed Wabery webhook → your logic or AI → POST /v1/messages
- Create the reply-ready project key during onboarding. Keep it secret.
- Stand up a public HTTPS endpoint and paste it into Wabery. Wabery generates a signing secret when it saves the endpoint. Verify signatures. Yes, actually verify them.
- Send Wabery’s
message.receivedtest event and confirm your endpoint returns 2xx. - Turn on Use my API so inbound messages route to you instead of a hosted agent.
- Join the sandbox and send a customer-style message.
- Reply by mapping
payload.channel_idandpayload.conversation_idfrom the event into the send call:
POST https://api.wabery.com/v1/messagesAuthorization: Bearer wab_live_...Content-Type: application/json
{ "channel_id": "channel_...", "conversation_id": "conv_...", "text": "Your generated reply"}In n8n the finished shape is Webhook → your logic / AI → HTTP Request. In Make it is Custom webhook → your modules → HTTP v4. In your own service it is a route handler and an outbound fetch.
Your system has to stay online to answer. That is the deal with Path B, and it is the honest reason Path A exists.
Step 4: Add the Parts an LLM Should Not Improvise
A pure LLM loop is a bad way to collect a phone number and a worse way to take a booking. Mix deterministic pieces into the conversation:
Automations. A trigger plus a chain of actions, running in Wabery with no server. Triggers are Welcome (first-ever message), Keyword, and Any message, evaluated first-match-wins. Actions include Send Reply with quick-reply buttons, Send Flow, Run Function, Delay, Wait for Reply, Condition, and Pause Replies. Use these for anything you want to happen the same way every single time. Automations.
WhatsApp Flows. Native in-chat forms. You define the fields, the customer fills a real form inside WhatsApp, and you receive validated JSON. Static flows render on-device; DATA_EXCHANGE flows fetch options from your HTTPS endpoint at runtime, which is how you do cascading dropdowns or per-user prefill. Publish one dynamic flow, not one flow per user. Flows.
Hosted functions. Project-scoped TypeScript that Wabery runs, for the one step that needs live data: a quote, a stock lookup, a routing decision, an agent tool. Deployments stay inactive until you review and activate them. Hosted functions.
Handoff. One conversation, two states. With handoff on, automations, external webhooks and public API outbound sends are all paused for that thread while a teammate replies in the inbox. Nothing else in the inbox is affected. Every agent needs this and the ones that skip it generate the angriest support tickets. Handoff.
Rule of thumb: automations first, functions only when a step genuinely needs code, the model for the parts that are actually conversation.
Step 5: Learn the Three WhatsApp Rules Before You Go Live
This is the part that is specific to WhatsApp and catches every team once.
The 24-hour window. After a customer messages you, you can reply freely for 24 hours. Outside that window you can only send an approved template, and it costs money. Design the conversation to finish inside the window rather than assuming you can follow up whenever.
Templates need approval. Any business-initiated message is a template Meta reviews. Write and submit them early. Discovering this on launch day is a bad day.
Opt-in is not optional. People must have agreed to hear from you. Blasting a purchased list is how numbers get quality-rated into uselessness, and quality ratings are hard to climb back out of.
Meta bills your dedicated WABA directly for messages and templates at its published rates. Wabery does not mark that up. For the shared sandbox, Wabery pays Meta and deducts the same published service rate from wallet credit after the October 1 cutoff. WhatsApp pricing notes.
Step 6: Build It With a Coding Agent, If You Want
Wabery has a hosted MCP server, so Claude, ChatGPT, Cursor, Codex or Claude Code can configure the project directly instead of you clicking through it.
claude mcp add --transport http wabery https://mcp.wabery.comThen hand it the goal:
Use the Wabery MCP server to help me complete the sandbox quickstart.List my projects, find the sandbox join code and number, tell me what tosend from my phone, then check whether the configured agent replied.Ask before making changes and do not publish anything to Live.There is also a CLI (npm i -g @wabery/cli), a REST API, a TypeScript SDK, and an OpenAPI 3.1 spec. Same project, four doors.
One distinction worth keeping straight: an MCP-connected coding agent is a build tool. It is not the always-on thing answering customers unless you separately deployed a backend for that job.
Step 7: Go Live Without Breaking Anything
Three names, and they are not decoration:
| Name | What it means |
|---|---|
| Draft | The version you are editing. Customers never see unfinished changes. |
| Sandbox | The shared WhatsApp number where you test the Draft from your own phone. |
| Live | The version answering customers on connected channels. |
Publishing is a deliberate step that replaces Live with the reviewed Draft. External tools and MCP clients cannot publish Live. A person reviews and publishes from the website.
That constraint exists for a specific 2026 failure mode. Once you have wired a coding agent into your infrastructure, and you should, the risk stops being “someone deployed a typo” and becomes “the agent confidently rewrote the system prompt at 2am.” If the number belongs to a client’s business, an approval step is the cheapest insurance available.
Then connect the real number under Channels. If you are moving a number from another provider, read Connect WhatsApp first, and do not delete or deregister the old number before you start. Connecting a number and publishing the agent are separate actions: a connected number does not push an unfinished Draft live.
What This Costs
- Wabery: free tier is one Live project and 500 messages a month, no card. Pro is $15 a month for two Live projects and 50K shared messages, then $5 and $3 for additional projects. Hosted agent model usage is billed from wallet credit at published model rates plus a disclosed margin. Bring your own backend and you pay us nothing for model usage.
- Meta: dedicated WABAs are billed directly at Meta’s rates. Shared-sandbox delivery is free through September 30; from October 1 the published service rate is deducted from wallet credit without markup.
- Live-project capacity starts when the project is real. It flips to Live automatically the first time a non-sandbox channel connects. Drafts use no Live-project capacity; sandbox delivery uses wallet credit after the cutoff.
The Build, Compressed
- Create a project. Do not open Meta Business Manager yet.
- Choose hosted agent or your own backend.
- Describe the job, or wire the webhook and send API.
- Text the join code from your phone and have a real conversation with it.
- Add automations, Flows, functions and handoff for the parts that must not be improvised.
- Learn the 24-hour window, templates and opt-in before launch, not after.
- Review the Draft, publish Live yourself, then connect the real number.
An afternoon to a working sandbox thread. The Meta paperwork happens in parallel, once you already know the agent is good.
Frequently Asked Questions
Do I need a WhatsApp Business number to start building?
No. Every project starts on a shared WhatsApp sandbox number joined with a code like wab-ABC123, so you can test from your own phone without Meta Business Manager or business verification. Sandbox delivery is free through September 30, 2026; from October 1 it uses wallet credit, and the $2 starter credit is allocated after you add a card.
Should the AI run on Wabery or on my own backend?
Use a Wabery-hosted agent when the job is describable in a paragraph and you do not want to operate a service. Use your own backend when the agent needs your data, your models, your prompt versioning, or your compliance boundary: Wabery sends a signed webhook and your system replies through POST /v1/messages. It is a project setting, so you can start hosted and switch later.
Can Claude or ChatGPT build the WhatsApp agent for me?
They can configure the project through Wabery's hosted MCP server at https://mcp.wabery.com, including creating automations, functions and channels. They cannot publish a hosted agent to Live: that stays a human action on the website, which is the point. An MCP-connected coding agent is a build tool, not the always-on system answering customers.
What are the WhatsApp rules that break new agents?
Three. You can only reply freely for 24 hours after a customer messages you, and outside that window you need an approved template. Business-initiated templates require Meta approval, so submit them early. And recipients must have opted in, because blasting a purchased list destroys your number's quality rating.
What does a WhatsApp AI agent cost to run?
The platform is free for one Live project and 500 messages a month, then $15 a month for two Live projects and 50K shared messages. Meta bills dedicated WABAs directly with no Wabery markup. Shared-sandbox delivery is free through September 30, 2026; from October 1 Wabery deducts the published service rate from wallet credit. Hosted-agent model usage is billed separately; bring your own backend and you pay nothing to us for model usage.
Comparing platforms before you build? The Zernio alternative page covers the developer-API lane, and the Kapso alternative page covers adding WhatsApp inside a product you own.
Questions or feedback? Reach out anytime
Continue Reading
Twilio WhatsApp Sandbox + OpenAI: The Agency Last Mile
Twilio's WhatsApp sandbox can get an OpenAI chatbot demo running this afternoon. Here is what it takes to move that demo onto a client's own WhatsApp Business number.
Zernio vs Wabery (2026): One API for Sixteen Platforms, or One WhatsApp Agent Shipped
Zernio spans sixteen social platforms and wins on raw connection price. Wabery lets agencies demo a WhatsApp chatbot, then run it on the client's WABA.
Kapso vs Wabery (2026): Which One Fits an Agency Shipping Client Chatbots?
Kapso and Wabery both run on the official WhatsApp Cloud API, with a sandbox, a CLI, and an MCP server. The real difference is what you're billed for: connected numbers, or Live client projects.