E2E Testing for Chat, Voice, Phone and Video AI Agents
Run Thousands of Test Scenarios against Your Agent and Catch Hallucinations, Bias, and Toxicity Before Users Do.
How to Test a WhatsApp Bot: Sandbox, Templates, Buttons and Load (2026 Guide)
How to test a WhatsApp bot: sandboxes, the 24-hour window and October 2026 pricing, buttons and lists, opt-out, load, and no-code runs on TestMu AI.
A WhatsApp bot can fail in ways a web chatbot does not: a free-form reply is rejected because the 24-hour window closed, a translated button title runs past 20 characters, or a customer who typed STOP keeps getting order updates. Testing one has two halves, the conversation logic you would check on any channel and the WhatsApp Business Platform rules around it, with Meta's limits and prices below as of October 2026. For the method on any channel, see chatbot testing; to send messages from a script rather than test a bot, see Python WhatsApp automation.
Overview
To test a WhatsApp bot, build the first tests on a test number or sandbox and finish on a registered staging number, never on real customers. Check the WhatsApp rules first: the 24-hour window, templates, buttons and opt-out. Then test the conversation itself: TestMu AI Agent Testing runs those scenarios without code against the bot's chat API.
Where Should You Run WhatsApp Bot Tests?
- Meta Cloud API test number: Meta creates a test business phone number when you start with the Cloud API. Payment method needed to send template messages: No. Messaging limits: relaxed. The temporary access token expires quickly. Staging needs a permanent system user token.
- Twilio Sandbox for WhatsApp: The Twilio Sandbox for WhatsApp uses the shared number +1 415 523 8886. Sandbox sessions expire three days after joining. The Sandbox sends one message every three seconds and offers three pre-approved templates only. Production use: No.
- Registered staging number: A registered staging number is a real business phone number pointed at your staging back end, with your own approved templates. Meta's message rules and prices apply, so finish on it to check templates, the window and rendering.
Which WhatsApp Rules Should the Tests Cover?
- 24-hour customer service window: A user's message or call opens a 24-hour customer service window. Free-form reply inside the window: Yes. Free-form reply outside it: No; only an approved template goes out, and a free-form send fails with Meta error 131047.
- Service message pricing: Since October 1, 2026, each business phone number gets 1,000 free delivered service messages a month, and Meta charges from the 1,001st. Utility messages sent inside an open window are charged again from October 1, 2026, so a regression suite on a real number has a cost.
- Reply buttons: A WhatsApp reply-button message takes up to 3 buttons, each with a title of up to 20 characters. Assert on the button ID your webhook receives as well as the label, because a translated title can run past the limit.
- List messages: A WhatsApp list message takes up to 10 rows across up to 10 sections, with row titles of up to 24 characters. Test the row ID your webhook receives as well as the row title.
- Opt-out error 131050: Meta requires opt-in before a business messages people on WhatsApp. Error 131050 means the user stopped receiving your marketing messages from the business, so the bot must not retry that send.
- Webhook retries: Meta retries a failed webhook delivery with decreasing frequency for up to 7 days, and the retries can arrive as duplicates, so process each message ID once.
How Do You Set Up a Test Number or Sandbox for a WhatsApp Bot?
Test a WhatsApp bot on Meta's Cloud API test number or the Twilio Sandbox for WhatsApp, so no real customer receives a test message. Finish on a registered staging number, because both sandboxes differ from production in ways your tests depend on.
| Option | How it works | Limits to know (October 2026) |
|---|---|---|
| Meta Cloud API test number | Starting with the Cloud API creates a test WhatsApp account, a test Messaging account and a test business phone number; send the hello_world template to check the wiring. | Relaxed messaging limits and no payment method needed for template messages. The temporary access token expires quickly, so create a permanent system user token. |
| Twilio Sandbox for WhatsApp | Testers send join plus your sandbox code, or scan the QR code, to the shared number +1 415 523 8886; you set the webhook and status callback URLs in the Sandbox settings. | Sessions expire three days after joining, one message every three seconds, three pre-approved templates only, legacy Console only, not for production. |
| Registered staging number | A real business phone number pointed at your staging back end, with your own approved templates. | Meta's message rules and prices apply, and messages outside a customer service window count against your business portfolio's messaging limit. |
The Twilio Sandbox for WhatsApp documentation names the three templates (Appointment Reminders, Order Notifications and Verification Codes), says messaging a user who has not joined fails with error 63015, and bills Sandbox messages at standard Twilio API for WhatsApp pricing, with 100 WhatsApp messages in a free trial account. Meta's Cloud API overview is the source for the test number's relaxed limits, and its get-started guide says the temporary token used for the hello_world message is not suitable for development.
Before the first test, check that you have:
- A verified webhook that receives message events and status events (sent, delivered, read and failed on the Cloud API; Twilio's status callback also reports queued).
- A permanent access token on staging, never the temporary one.
- Test recipients who opted in and know how to leave; Twilio Sandbox testers leave by replying stop.
- Logs that keep the inbound payload, your outbound request and every status event under one message ID, so a window or template failure can be traced.
How Do Templates and the 24-Hour Window Change WhatsApp Bot Tests?
A WhatsApp bot can send free-form messages only while a customer service window is open; outside it, only an approved template goes out. Every test therefore needs to know which state the conversation is in and, since October 1, 2026, what each state costs.
These rules come from Meta's WhatsApp pricing documentation as of October 2026:
- Window - When a user messages or calls the business, a 24-hour customer service window starts, and a new message or call before it expires resets the timer to 24 hours.
- Categories - Templates are marketing, utility or authentication. Non-template messages are service, or Meta Business Agent when the Meta Business Agent Platform powers them, a category Meta added on July 1, 2026.
- Per-message pricing - Meta has charged per message since July 1, 2025, and only for delivered messages.
- Service messages - Service conversations became free on November 1, 2024. Since October 1, 2026, each business phone number gets 1,000 free delivered service messages a month that do not roll over, Meta charges from the 1,001st, and without a payment method Meta stops delivering service messages once the free tier is used.
- Utility messages in the window - Free since July 1, 2025 and charged again from October 1, 2026, when their status webhook pricing type changed from free_customer_service to regular.
- Volume tiers - Lower rates apply to utility and authentication messages only.
A staging number that sent service replies at no charge before October 2026 now draws on that monthly free tier, and one long regression run can use it up. That is where bot testing automation belongs on the bot's chat API: the conversation suite runs on every change, while the real number checks templates, the window and rendering.
Run this matrix with Meta's WhatsApp error code reference open, because each failing row names the code your system should handle.
| # | State | Action | Expected result |
|---|---|---|---|
| 1 | Window open: the user wrote 5 minutes ago | The bot sends a free-form reply | Delivered; the status webhook shows pricing category service, with type free_customer_service inside the number's 1,000 free service messages and regular after them |
| 2 | Window open, order shipped | The bot sends a utility template | Delivered; since October 1, 2026 the pricing type is regular, so assert on it and let cost alerts see it |
| 3 | Window closed: the last user message is over 24 hours old | The bot tries a free-form reply | The send fails with error 131047; the bot switches to an approved template or waits for the user to write |
| 4 | Window closed, user opted in | The bot sends an approved marketing template | Delivered and charged as marketing; error 131050 if the user stopped marketing messages from the business |
| 5 | Template answered | The user replies to the template | A new 24-hour window opens and free-form replies work again |
| 6 | Template with variables | The bot fills the placeholders | Every placeholder is filled in each approved language; error 132000 if the parameter count does not match |
| 7 | Template not approved in a language | The bot sends it in that language | Error 132001; the bot falls back to an approved language or a person |
| 8 | Template paused or disabled | The bot sends it | Error 132015 (paused for low quality) or 132016 (permanently disabled) leads to a fallback, never a silent failure |
| 9 | Free service tier used up this month | A service reply after the 1,000th | Delivered and charged (pricing type regular) when a payment method is on file; not delivered without one |
How Do You Test Languages and Answer Quality on a WhatsApp Bot?
Run the same scenarios in every language you support, including mixed-language messages, transliteration, slang and typos, and check both what the bot understood and how it answered.
- Code-switching - Users mix languages in one message, such as Hindi and English, so test the mixed form and not only each language alone.
- Script variants - Native script and transliterated text ("mera order kahan hai") should reach the same intent.
- Templates per language - The bot answers in the user's language and picks the template version approved in that language.
- Made-up answers - An AI-powered bot that invents a 90-day return policy fails the same way on WhatsApp as on the web, but the customer has no page to check it against; the guide to chatbot hallucination covers the test set.
- Mobile tone - Short replies, no walls of text, and the brand voice held when a customer is angry.
These conversation checks are the part that runs without code on TestMu AI Agent Testing, shown later in this guide.
How Do You Test Opt-In and Opt-Out on a WhatsApp Bot?
Check that the bot messages only people who opted in, that a request to stop is honored at once and recorded, and that a user who stopped or blocked the business causes no retry loop. Meta's opt-in guidance requires opt-in before a business messages people on WhatsApp, and asks businesses to explain how to opt out of each message category and to honor those requests.
- STOP, unsubscribe, "don't message me" and local-language equivalents are recognized at any point in a flow, including mid-purchase.
- The opt-out is written to your system of record and blocks future marketing sends, while replies to the user's own questions still work.
- A user who stopped marketing messages from your business returns error 131050, and your system records it and does not retry, as Meta's error reference advises.
- Opt-in records capture what the user agreed to, for which message categories, and when.
- A user who opted out can opt in again, and the bot resumes only the categories the user chose.
- Test recipients can leave the test, for example by replying stop to the Twilio Sandbox.
How Do You Test End-to-End WhatsApp Flows and Webhooks?
Run complete journeys from the first message to the final outcome and check the result in your back-end systems, not only in the chat transcript. An order-status journey, for example:
- The user sends "where is my order", and the bot asks for the order number with buttons or text.
- The user sends an invalid number, and the bot asks again, with no crash and no stack trace in the reply.
- The user sends a valid number, and the bot calls the order API and returns the right status and delivery estimate.
- The user asks for a person, and the conversation goes to a live agent with its context attached.
- The CRM or ticketing system shows the conversation and the hand-off, and the order API log shows one call, not three.
Also test these conditions around the journey:
- Duplicate deliveries - Meta's webhooks documentation says a delivery that does not get HTTP 200 is retried with decreasing frequency for up to 7 days, and retries can arrive as duplicates, so process each message ID once.
- Ordering - A burst of messages from one user still gets replies in a sensible order.
- Timeouts - The user gets a holding reply when the order API takes 10 seconds to answer.
- Back end down - The bot sends a holding message, then recovers when the service returns.
On TestMu AI Agent Testing, Data Validation checks the facts a chat agent states, such as an order status or a delivery date, against your own system of record through read-only API lookups, with a Pass, Fail or Cannot verify verdict per fact.
For scripted checks, assert on outcomes rather than sentences: which element the bot sent, which ID came back and which API call ran. The sketch below uses helpers you write around your webhook log and order API, and the same idea scales to a full set of chatbot test cases.
// Sketch: assert on state and IDs, not on wording
const reply = await waitForBotReply(chatId, 10000);
expect(reply.type).toBe("interactive");
const ids = reply.buttons.map((b) => b.id);
expect(ids).toContain("enter_order_number");
await sendUserText(chatId, "ORD-10492");
const status = await waitForBotReply(chatId, 10000);
expect(status.text).toMatch(/ORD-10492/);
expect(await orderApiCalls("ORD-10492")).toBe(1);How Do You Load Test a WhatsApp Bot?
Load test your webhook and back end with simulated inbound messages, and test real send throughput on a staging number within Meta's limits. The Twilio Sandbox is not built for this: Twilio's documentation says it "supports functional testing, but not load testing of profile traffic", and its number sends one message every three seconds.
- Inbound bursts - Send bursts of simulated webhook events, such as a campaign reply spike or a recovery after an outage, straight at your endpoint and measure response time, error rate and queue depth. If you already keep JMeter or Gatling plans, HyperExecute runs them natively without a rewrite.
- Throughput errors - Your queue handles error 130429 (Cloud API message throughput reached) and 131056 (too many messages to the same recipient in a short period) by waiting and retrying, without duplicate messages.
- Messaging limit - Meta's messaging limits page defines the limit as the number of unique WhatsApp users your business can deliver messages to outside a customer service window within a moving 24 hours, shared across the business portfolio; WhatsApp Manager shows it under Account tools, Messaging limits.
- Cost - Since October 2026, high-volume service traffic on a real number is charged after the free tier, so keep load runs on the endpoint and rendering checks on the number.
- Re-runs - Repeat the load test after infrastructure, model or template changes.
WhatsApp Bot Conversation Tests You Can Run on TestMu AI Without Code
TestMu AI Agent Testing tests the conversation side of a WhatsApp bot through the bot's own chat API: you connect a chat agent over its API, describe correct behavior, and AI evaluators message it like a real customer and check replies for completeness, context awareness and tone rather than one exact sentence. More than fifteen testing agents score each exchange, the same way as testing a chatbot without code.
| Check | Where it runs | What proves it |
|---|---|---|
| Conversation logic, memory, tone, made-up answers, languages, prompt injection and PII leaks | TestMu AI Agent Testing, through the bot's chat API | Generated multi-turn scenarios scored on nine quality metrics, with the transcript turn behind each score |
| Facts the bot states, such as an order status | Agent Testing Data Validation | Read-only lookups against your system of record, one verdict per fact |
| Templates, the 24-hour window, the pricing type | A Cloud API test number or a staging number | Meta's API responses and status webhooks |
| Button and list rendering, tapped IDs | Real phones on a test or staging number | The button_reply or list_reply in your webhook |
| Opt-out inside WhatsApp | A staging number | Error 131050 and your opt-out records |
| Webhook and send load | A load test against your endpoint, plus a staging number within its messaging limit | Response times, error rates and Meta's throughput errors |
Agent Testing does not send WhatsApp messages, so it does not see template approval, delivery status or rendering, and its standard evaluation does not model production-scale concurrent usage. The walkthrough below is one session against an order-tracking bot.
Connecting the WhatsApp Bot's Chat Endpoint
There was no SDK to install and no browser extension to deploy. I connected the bot by pasting its chat endpoint, then uploaded the two documents that already existed for it: a short PRD and the knowledge base the support team maintains. The platform parsed both and pulled out the policies the bot follows, the topics it covers, and a set of scenario seeds.
The one input that took real thought was the agent-under-evaluation prompt, a plain description of what good behavior looks like. I wrote a few lines: the bot is a customer service agent for an online store, it helps with orders and returns, it stays concise and empathetic, and it must never invent policies or delivery dates. That prompt becomes the baseline the evaluators grade against. The whole setup ran under thirty minutes, and none of it needed a line of code.
Writing the First Order-Tracking Conversation
I started with the dull happy path, because if that breaks nothing else matters. A customer asks to track an order, the bot asks for the number, the customer gives it, the bot returns a status. Had I scripted that against the WhatsApp Business API, it would have looked like this:
const url = "https://graph.facebook.com/v26.0/" + PHONE_NUMBER_ID + "/messages";
const send = await axios.post(url, {
messaging_product: "whatsapp",
to: "15551234567",
type: "text",
text: { body: "I need to track my order" }
}, { headers: { Authorization: "Bearer " + WHATSAPP_TOKEN } });
const reply = await waitForWebhookReply(send.data.messages[0].id);
assert.strictEqual(
reply.text.body,
"Sure! Please share your 5-digit order number and I will look it up."
);A dozen lines, and fragile before it even runs. The assertion demands one exact sentence, but the bot is generative, so the wording moves every run and a perfectly correct answer fails the check. On top of that I would own the webhook plumbing, a dedicated WhatsApp test number, and a growing pile of string matches, plus someone on the team who reads JavaScript. Instead, I described the same exchange as steps the evaluators follow:
- Open the way a customer would, with something like, I want to track my order
- Expect the bot to ask for an order number
- Send the order number 48213
- Expect a current status and an estimated delivery date in return
- Watch that the bot stays polite and on brand across the exchange
- Grade the conversation for completeness, context awareness, and tone
With the TestMu AI chatbot testing platform, that description is the check. The evaluators message the bot the way a real customer would and grade the exchange by meaning rather than by matching a fixed string. When the wording changes but the intent holds, it passes. When the bot forgets the order number or invents a policy, it fails, and the exact turn that went wrong comes attached.
If you keep scripted checks beside the evaluators, assert on state rather than wording, as in the end-to-end sketch above.
Watching the Evaluators Score the Conversation
Running it looked less like a test suite and more like watching a shift of testers work at once. Behind the single check, more than fifteen specialized testing agents ran in parallel, each probing a different failure mode, and each scored the reply against the nine quality metrics. The order-tracking path came back clean.
What made the result usable was the evidence next to every score. Each metric carried a confidence level of High, Medium, or Low, plus an excerpt from the conversation that drove the verdict, so I could open the exact turn behind any number instead of trusting a figure in a vacuum. All of it rolled up into one production-readiness verdict, Green, Yellow, or Red, that a support lead or a product manager can read in a few seconds.
Adding Angry, Follow-Up, Policy and Hindi Scenarios
The happy path passing told me the plumbing worked. It told me nothing about the screenshot that started my afternoon. The failures that lose customers hide in the conversations a string match cannot see, so I added four more, each phrased the way I would brief a new support agent rather than the way I would write code.
- I opened angry about a third late order and watched whether the bot acknowledged the frustration before it reached for a fix, which the tone and personality evaluator scores
- I tracked one order, then asked to change the delivery address on it, since a bot that asks for the order number again fails context awareness
- I asked about a 90 day free-return window that does not exist, because the bot should state the real policy instead of inventing terms, and that is what hallucination detection watches for
- I sent the same order question in Hindi, so the bot had to answer helpfully without switching me to English on its own, and completeness and bias detection flag it when it slips
Writing four scenarios by hand is fine. Writing a hundred is not, which is where the earlier document upload paid off. From that PRD and knowledge base, the platform generated more than sixty scenarios on its own, spread across happy paths, edge cases, adversarial inputs, and persona variants like the Angry User and the Multi-Lingual User. One angry-customer sketch became a systematic sweep, and the second run came back Yellow, with the failing turn pointing straight at a cold reply the demo had never surfaced.
Red-Teaming the Bot for Prompt Injection and PII Leaks
Functional coverage still left one gap. A WhatsApp number that anyone can message also invites the messages no honest customer sends, so before I called the session done I ran a red-team pass over the same bot. The point was to treat the bot as something an attacker would poke at, then read what it gave up.
The red-team run pointed prompt-injection, jailbreak, and PII-leakage probes at the endpoint, driven by the Security Researcher and Data Privacy Guardian among the evaluators. One probe tried to talk the bot into reading back another customer's order details; another buried a hidden instruction inside a normal-looking order query to see whether the bot would follow it. Every finding came back with evidence: each flagged turn carried the message that triggered it, so a leak was a transcript I could open with the exact words that caused it.
This is the part of WhatsApp chatbot testing that a functional check never reaches. A bot that quotes the real return policy but hands a stranger someone else's phone number is not production-ready, and the red-team findings made that call for me instead of leaving it to a friendly demo. Security checks like these sit beside functional and conversational tests in the guide on how to test a chatbot.
Running the Suite in CI and on a Schedule
A one-time verdict fades the moment someone edits the prompt or the underlying model ships an upstream update. To keep the afternoon from being a one-off, I moved the same plain-English scenarios into the pipeline.
The Agent Testing CLI installs with pip install agent-testing-cli, reads the LT_USERNAME and LT_ACCESS_KEY environment variables in CI and writes machine-readable JSON with the --json option, so it drops into an existing CI job without a custom plugin. This is the CI command the docs give for a chat evaluation:
pip install agent-testing-cli
agent-testing-cli --project "$TESTMU_PROJECT_ID" \
--json run \
--workflow "$TESTMU_WORKFLOW_ID" \
--suite "$TESTMU_SUITE_ID" \
--yesChat evaluations are asynchronous, so the docs say not to add --wait to a chat run; the job starts the suite, and a later step reads the result with agent-testing-cli results --suite SUITE_ID. The docs list exit code 0 for a command that completed successfully and 1 for a completed test that failed, and say to use the exit code to fail a CI/CD job when a command does not complete successfully.
On top of the gate, I scheduled a weekly run so a quiet model change or a stale knowledge-base answer cannot degrade the bot between releases, and sent the Agent Testing notifications to a webhook. Because this bot sits behind a corporate firewall, I used the secure tunnel through HyperExecute, which opens an encrypted connection to the endpoint without ever exposing it to the public internet.
By the end of the session the bot had a verdict, a widened scenario set, a weekly scheduled run, and a gate in CI. The same TestMu AI Agent Testing platform covers chat, voice, phone, video and image agents, so when this bot grows a phone line, the same plain-English scenarios you would use to test a voice agent without code follow it there. If that phone line runs on Bland AI, the guide on how to test a Bland AI calling agent covers its Conversational Pathways.
Note: Point the evaluators at your own WhatsApp bot and read the first verdict in an afternoon. Start with TestMu AI free.
Testing an AI agent? TestMu AI's Agent Testing validates chat, voice and IVR agents before your customers talk to them.
Was this helpful?
Authors

Samyak Goyal
Author · 56 posts
Samyak Goyal is a Senior Member of Technical Staff at TestMu AI engineering Kane CLI, the command-line tool that runs browser automation from the terminal, where a flow described in natural language executes in a real Chrome browser and returns pass or fail with shareable proof. He is a backend engineer with 4+ years of experience, previously an SDE at Innovaccer, where he built APIs, introduced Kafka, and cut deployment from weeks to hours. Samyak also builds multi-agent systems, skill-orchestration frameworks, and a personal copilot that indexes 200+ microservice repositories.
Aman Chopra
Reviewer
Aman Chopra is a DevOps Engineer and Community Contributor with over 7 years of experience in cloud technologies, software development, and software testing. Currently working at TestMu AI, Aman specializes in optimizing Azure cloud infrastructure, enhancing API accessibility, and integrating cloud platforms like AWS and GCP. With expertise in Git, Docker, Kubernetes, and CI/CD practices, Aman has contributed to various open-source projects and authored guides on cloud computing, containers, and CI/CD. He holds a B.Tech in Computer Science.
WhatsApp Bot Testing FAQs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests

