{"id":2189,"date":"2026-11-24T19:30:33","date_gmt":"2026-11-24T19:30:33","guid":{"rendered":"https:\/\/vectalk.com.br\/blog\/test-whatsapp-bot-automated-tests\/"},"modified":"2026-11-24T19:30:38","modified_gmt":"2026-11-24T19:30:38","slug":"test-whatsapp-bot-automated-tests","status":"publish","type":"post","link":"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/","title":{"rendered":"How to test a WhatsApp bot: simulated payloads and automated tests"},"content":{"rendered":"\n<p><em>Updated on November 24, 2026<\/em><\/p>\n\n\n\n<p>To test a WhatsApp bot without relying on a phone, split the bot along two boundaries: the input (the webhook payload) and the output (the send call). In your tests, you inject simulated payloads in Meta&#8217;s exact format and swap the real sender for a fake one that records what the bot would try to send. Only the last layer, staging, uses the real API, with Meta&#8217;s test number or a number separate from production.<\/p>\n\n\n\n<p>This article builds on <a href=\"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-webhook-locally\/\">how to test the webhook locally with ngrok<\/a>, which covers the connection between Meta and your machine. Here the focus is what comes next: automated tests that run in CI in seconds, with no network and no real customer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The four testing layers<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Layer<\/th><th>What it tests<\/th><th>Uses Meta?<\/th><th>Runs in CI?<\/th><\/tr><\/thead><tbody><tr><td>Unit<\/td><td>Payload parser, signature, business rules<\/td><td>No<\/td><td>Yes<\/td><\/tr><tr><td>Flow<\/td><td>Full conversations with simulated payloads and a fake sender<\/td><td>No<\/td><td>Yes<\/td><\/tr><tr><td>Endpoint integration<\/td><td>Real HTTP route: signature, <code>200<\/code>, deduplication<\/td><td>No<\/td><td>Yes<\/td><\/tr><tr><td>Staging<\/td><td>Real sending and receiving, on a number that is not production<\/td><td>Yes<\/td><td>Manual or scheduled<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Most bot bugs show up in the first two layers: a field read from the wrong place, a button title that is too long, a duplicated reply. They take milliseconds to run, so it pays to have plenty of them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Separate input, logic and output<\/h2>\n\n\n\n<p>A testable bot receives the payload and a sender object as parameters, instead of calling the API directly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-python\"># bot.py\nRANK = {\"sent\": 1, \"delivered\": 2, \"read\": 3}\n\nMENU = [(\"confirm\", \"Confirm\"), (\"reschedule\", \"Reschedule\")]\n\n\nclass MemoryStore:\n    def __init__(self):\n        self.seen: set[str] = set()\n        self.status: dict[str, str] = {}\n\n    def first_time(self, wamid: str) -&gt; bool:\n        if wamid in self.seen:\n            return False\n        self.seen.add(wamid)\n        return True\n\n    def apply_status(self, wamid: str, status: str) -&gt; None:\n        current = self.status.get(wamid)\n        if status == \"failed\" or current is None:\n            self.status[wamid] = status\n        elif current != \"failed\" and RANK.get(status, 0) &gt; RANK.get(current, 0):\n            self.status[wamid] = status\n\n\ndef handle_event(payload: dict, sender, store: MemoryStore) -&gt; None:\n    for entry in payload.get(\"entry\", []):\n        for change in entry.get(\"changes\", []):\n            value = change.get(\"value\", {})\n            for msg in value.get(\"messages\", []):\n                if store.first_time(msg[\"id\"]):\n                    handle_message(msg, sender)\n            for st in value.get(\"statuses\", []):\n                store.apply_status(st[\"id\"], st[\"status\"])\n\n\ndef handle_message(msg: dict, sender) -&gt; None:\n    to = msg[\"from\"]\n    if msg[\"type\"] == \"text\":\n        sender.buttons(to, \"Can you confirm your appointment tomorrow at 2 p.m.?\", MENU)\n    elif msg[\"type\"] == \"interactive\" and msg[\"interactive\"][\"type\"] == \"button_reply\":\n        choice = msg[\"interactive\"][\"button_reply\"][\"id\"]\n        if choice == \"confirm\":\n            sender.text(to, \"Appointment confirmed. See you tomorrow!\")\n        elif choice == \"reschedule\":\n            sender.text(to, \"No problem. Which day works best for you?\")\n    else:\n        sender.text(to, \"For now I only understand text and buttons.\")<\/code><\/pre>\n\n\n\n<p>In production, <code>sender<\/code> is the class that makes the <code>POST<\/code> to <code>\/messages<\/code>. In tests, it is a fake. <code>apply_status<\/code> already handles a real-world detail: Meta&#8217;s <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/webhooks\/reference\/messages\/status\" target=\"_blank\" rel=\"noreferrer noopener\">status webhook reference<\/a> explains that if the customer reads the message with the chat open, the <code>delivered<\/code> webhook may not be sent, and <code>read<\/code> arrives directly. A status should never &#8220;go back&#8221; from <code>read<\/code> to <code>delivered<\/code>. More on this in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-webhook-message-order\/\">message and status ordering in the webhook<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Fixtures: payloads in Meta&#8217;s format<\/h2>\n\n\n\n<p>Build payloads with small functions instead of pasting huge JSON blobs into every test. The envelope follows the format documented by Meta and forwarded unchanged by Vectalk, according to <a href=\"https:\/\/docs.vectalk.com.br\/concepts\/webhooks\">Vectalk&#8217;s webhook documentation<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-python\"># tests\/fixtures.py\nCUSTOMER = \"5511988887777\"\n\n\ndef envelope(value: dict) -&gt; dict:\n    return {\n        \"object\": \"whatsapp_business_account\",\n        \"entry\": [{\n            \"id\": \"WABA_ID\",\n            \"changes\": [{\n                \"field\": \"messages\",\n                \"value\": {\n                    \"messaging_product\": \"whatsapp\",\n                    \"metadata\": {\n                        \"display_phone_number\": \"5511999990000\",\n                        \"phone_number_id\": \"PHONE_NUMBER_ID\",\n                    },\n                    **value,\n                },\n            }],\n        }],\n    }\n\n\ndef text_msg(body: str, wamid: str = \"wamid.T1\", frm: str = CUSTOMER) -&gt; dict:\n    return envelope({\n        \"contacts\": [{\"profile\": {\"name\": \"Test Customer\"}, \"wa_id\": frm}],\n        \"messages\": [{\n            \"from\": frm, \"id\": wamid, \"timestamp\": \"1764000000\",\n            \"type\": \"text\", \"text\": {\"body\": body},\n        }],\n    })\n\n\ndef button_reply(button_id: str, title: str, wamid: str = \"wamid.B1\", frm: str = CUSTOMER) -&gt; dict:\n    return envelope({\n        \"contacts\": [{\"profile\": {\"name\": \"Test Customer\"}, \"wa_id\": frm}],\n        \"messages\": [{\n            \"from\": frm, \"id\": wamid, \"timestamp\": \"1764000100\",\n            \"type\": \"interactive\",\n            \"interactive\": {\"type\": \"button_reply\", \"button_reply\": {\"id\": button_id, \"title\": title}},\n        }],\n    })\n\n\ndef status(wamid: str, value: str, code: int | None = None) -&gt; dict:\n    st = {\"id\": wamid, \"status\": value, \"timestamp\": \"1764000200\", \"recipient_id\": CUSTOMER}\n    if code is not None:\n        st[\"errors\"] = [{\"code\": code, \"title\": \"simulated error\"}]\n    return envelope({\"statuses\": [st]})<\/code><\/pre>\n\n\n\n<p>Have at least one fixture for each message type the bot handles (text, button, list, image, location) and for each status (<code>sent<\/code>, <code>delivered<\/code>, <code>read<\/code>, <code>failed<\/code>). The formats for each type are in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-webhook-payload-examples\/\">webhook payload examples<\/a>.<\/p>\n\n\n\n<p>If you already store raw events in production, they are the best source of fixtures, because they show cases nobody thought to simulate. Before committing them to the repository, replace phone numbers, names and content with fictitious values. Customer personal data in Brazil is covered by the LGPD (Lei 13.709\/2018, Brazil&#8217;s general data protection law, similar in spirit to the GDPR); talk to your legal team about what can be kept and for how long. This article is not legal advice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The fake sender that enforces limits<\/h2>\n\n\n\n<p>The fake does more than record calls: it also enforces Meta&#8217;s limits, so that an overly long text breaks the test instead of production.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-python\"># tests\/fake_sender.py\nclass FakeSender:\n    def __init__(self):\n        self.sent: list[dict] = []\n\n    def text(self, to: str, body: str) -&gt; None:\n        assert 0 &lt; len(body) &lt;= 4096, \"text over 4,096 characters\"\n        self.sent.append({\"to\": to, \"type\": \"text\", \"body\": body})\n\n    def buttons(self, to: str, body: str, options: list[tuple[str, str]]) -&gt; None:\n        assert len(body) &lt;= 1024, \"button body over 1,024 characters\"\n        assert 1 &lt;= len(options) &lt;= 3, \"maximum of 3 buttons\"\n        for button_id, title in options:\n            assert len(title) &lt;= 20, f\"title '{title}' over 20 characters\"\n            assert len(button_id) &lt;= 256, \"button id over 256 characters\"\n        self.sent.append({\"to\": to, \"type\": \"buttons\", \"body\": body, \"options\": options})<\/code><\/pre>\n\n\n\n<p>The numbers come from Meta&#8217;s pages: up to 4,096 characters for <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/messages\/text-messages\" target=\"_blank\" rel=\"noreferrer noopener\">text messages<\/a>; up to 3 buttons, titles up to 20 characters, ids up to 256 and a body up to 1,024 for <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/messages\/interactive-reply-buttons-messages\" target=\"_blank\" rel=\"noreferrer noopener\">reply buttons<\/a>. The remaining limits are in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-character-limits\/\">WhatsApp Business API character limits<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Flow tests<\/h2>\n\n\n\n<p>With fixtures and the fake sender, each conversation becomes a readable test:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-python\"># tests\/test_flow.py\nfrom bot import MemoryStore, handle_event\nfrom tests.fake_sender import FakeSender\nfrom tests.fixtures import CUSTOMER, button_reply, status, text_msg\n\n\ndef test_first_message_shows_buttons():\n    sender, store = FakeSender(), MemoryStore()\n    handle_event(text_msg(\"hi\"), sender, store)\n    assert sender.sent[0][\"type\"] == \"buttons\"\n    assert sender.sent[0][\"to\"] == CUSTOMER\n\n\ndef test_confirm_replies_with_confirmation():\n    sender, store = FakeSender(), MemoryStore()\n    handle_event(text_msg(\"hi\"), sender, store)\n    handle_event(button_reply(\"confirm\", \"Confirm\"), sender, store)\n    assert sender.sent[-1][\"body\"] == \"Appointment confirmed. See you tomorrow!\"\n\n\ndef test_duplicate_event_does_not_reply_twice():\n    sender, store = FakeSender(), MemoryStore()\n    event = text_msg(\"hi\", wamid=\"wamid.DUP\")\n    handle_event(event, sender, store)\n    handle_event(event, sender, store)\n    assert len(sender.sent) == 1\n\n\ndef test_read_before_delivered_does_not_regress():\n    sender, store = FakeSender(), MemoryStore()\n    handle_event(status(\"wamid.OUT1\", \"read\"), sender, store)\n    handle_event(status(\"wamid.OUT1\", \"delivered\"), sender, store)\n    assert store.status[\"wamid.OUT1\"] == \"read\"\n\n\ndef test_failure_is_recorded():\n    sender, store = FakeSender(), MemoryStore()\n    handle_event(status(\"wamid.OUT2\", \"sent\"), sender, store)\n    handle_event(status(\"wamid.OUT2\", \"failed\", code=131047), sender, store)\n    assert store.status[\"wamid.OUT2\"] == \"failed\"\n\n\ndef test_unknown_type_gets_default_reply():\n    sender, store = FakeSender(), MemoryStore()\n    event = text_msg(\"x\")\n    event[\"entry\"][0][\"changes\"][0][\"value\"][\"messages\"][0][\"type\"] = \"sticker\"\n    handle_event(event, sender, store)\n    assert \"text and buttons\" in sender.sent[0][\"body\"]<\/code><\/pre>\n\n\n\n<p>The duplicate test exists because Meta may resend the same event; a bot without deduplication replies to the customer twice. The full pattern, with Redis or a unique index in the database, is in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-webhook-duplicate-events-idempotency\/\">duplicate webhooks and idempotency<\/a>.<\/p>\n\n\n\n<p>Cases worth one test each:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A message of a type the bot does not handle (sticker, reaction, location).<\/li>\n\n\n<li>A single <code>POST<\/code> with several messages and statuses together in the same payload.<\/li>\n\n\n<li>A <code>failed<\/code> status with code <code>131047<\/code> (outside the 24-hour window), which should trigger a template instead of free-form text.<\/li>\n\n\n<li>A click on a button from an old message, after the conversation has already moved on.<\/li>\n\n\n<li>Text with emoji, accented characters and line breaks.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Endpoint integration test<\/h2>\n\n\n\n<p>The flow layer does not go through the HTTP route. An endpoint integration test makes sure the signature, the <code>200<\/code> code and the routing are right. The signature is an HMAC-SHA256 of the body using the app secret, as described on <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/webhooks\/create-webhook-endpoint\" target=\"_blank\" rel=\"noreferrer noopener\">Meta&#8217;s webhook endpoint page<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-python\"># tests\/test_endpoint.py\nimport hashlib\nimport hmac\nimport json\n\nfrom tests.fixtures import text_msg\n\nSECRET = \"test-secret\"\n\n\ndef sign(body: bytes) -&gt; str:\n    return \"sha256=\" + hmac.new(SECRET.encode(), body, hashlib.sha256).hexdigest()\n\n\ndef test_webhook_accepts_valid_signature(client):\n    body = json.dumps(text_msg(\"hi\")).encode()\n    r = client.post(\n        \"\/whatsapp\/webhook\/\",\n        data=body,\n        content_type=\"application\/json\",\n        headers={\"X-Hub-Signature-256\": sign(body)},\n    )\n    assert r.status_code == 200\n\n\ndef test_webhook_rejects_tampered_body(client):\n    body = json.dumps(text_msg(\"hi\")).encode()\n    signature = sign(body)\n    r = client.post(\n        \"\/whatsapp\/webhook\/\",\n        data=body.replace(b\"hi\", b\"ok\"),\n        content_type=\"application\/json\",\n        headers={\"X-Hub-Signature-256\": signature},\n    )\n    assert r.status_code == 401<\/code><\/pre>\n\n\n\n<p>The example uses Django&#8217;s <code>client<\/code> with pytest-django; configuring the secret in tests and the view itself are covered in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-django\/\">WhatsApp Business API with Django<\/a>. For NestJS, the signature test and the path to end-to-end tests with Supertest are in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-nestjs\/\">WhatsApp Business API with NestJS<\/a>. In any framework, make sure the test sends the exact bytes that were signed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Staging: real tests without touching customers<\/h2>\n\n\n\n<p>After CI, you still need to see the message arrive on a phone. Three options, from simplest to closest to production:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Meta&#8217;s test number.<\/strong> On the app&#8217;s getting-started screen in Meta for Developers, Meta provides a test number, a temporary token and a field to register the numbers that will receive messages, according to the <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/get-started\" target=\"_blank\" rel=\"noreferrer noopener\">getting started page<\/a>. The temporary token expires quickly; for recurring tests, use a system user token.<\/li>\n\n\n<li><strong>The webhook &#8220;Test&#8221; button.<\/strong> Under <strong>WhatsApp \u2192 Webhooks \u2192 Configuration<\/strong> in the app dashboard, the <strong>Test<\/strong> link next to the <code>messages<\/code> field sends a sample payload to your URL, as shown in <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/webhooks\/set-up-whatsapp-echo-bot\" target=\"_blank\" rel=\"noreferrer noopener\">Meta&#8217;s echo bot tutorial<\/a>. It is useful for checking that the route responds, not for testing flows.<\/li>\n\n\n<li><strong>A dedicated staging number.<\/strong> A second number, with the same template and webhook setup as production, but pointing to the staging environment. It is the only way to test real templates, media and limits faithfully. This number is billed like any other.<\/li>\n\n<\/ol>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Item<\/th><th>Local<\/th><th>Staging<\/th><th>Production<\/th><\/tr><\/thead><tbody><tr><td>Number<\/td><td>None (fixtures)<\/td><td>Meta test number or dedicated number<\/td><td>Official number<\/td><\/tr><tr><td>Webhook<\/td><td><code>localhost<\/code> + ngrok<\/td><td>Staging URL<\/td><td>Production URL<\/td><\/tr><tr><td>Token<\/td><td>Fake<\/td><td>Staging token<\/td><td>Production token<\/td><\/tr><tr><td>Recipients<\/td><td>None<\/td><td>Team phones<\/td><td>Customers<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Never register the staging URL on the production number. Real customer messages would reach the test environment, which could reply to them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to do this with Vectalk<\/h2>\n\n\n\n<p>Vectalk forwards the same Meta payload to the registered URLs, so the fixtures above work unchanged. Two specific precautions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.vectalk.com.br\/concepts\/webhooks\">Vectalk&#8217;s webhook documentation<\/a> says you can register several URLs per instance and that <strong>all of them receive the same event<\/strong>. So don&#8217;t register the staging URL on the production instance: use a separate instance for the staging number, with its own webhook (<code>POST https:\/\/apis.vectalk.com.br\/api\/webhooks<\/code>).<\/li>\n\n\n<li>Use one token per environment. Instance tokens, created under <strong>Settings \u2192 API Tokens (Configura\u00e7\u00f5es \u2192 API Tokens)<\/strong>, only work with the instance they were created for, according to the <a href=\"https:\/\/docs.vectalk.com.br\/authentication\">authentication page<\/a>. This prevents a staging script from sending through the production number by mistake.<\/li>\n\n<\/ul>\n\n\n\n<p>The Hub expects a <code>200<\/code> in under 20 seconds. To check what was actually sent during a test, look at the logs in the dashboard or call <code>GET https:\/\/apis.vectalk.com.br\/api\/messages<\/code> with status and date filters, described in <a href=\"https:\/\/docs.vectalk.com.br\/api-reference\/messages\/list\">list messages<\/a>. To get started, <a href=\"https:\/\/apps.vectalk.com.br\/register\">create your account<\/a>. The big picture of the API is in the guide to the <a href=\"https:\/\/vectalk.com.br\/blog\/en\/official-whatsapp-api\/\">official WhatsApp Business API<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Do I need a phone to test the bot?<\/h3>\n\n\n\n<p>Not for most tests. Unit, flow and endpoint integration tests run with simulated payloads only. The phone comes in at staging, to see how the message really looks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can I test templates without sending them?<\/h3>\n\n\n\n<p>You can validate how the payload is built (name, language, number of parameters) with the fake sender. Approval and rendering only show up on a real send, on the test or staging number. One parameter too many or too few produces error <code>132000<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I simulate send API errors?<\/h3>\n\n\n\n<p>Make the fake sender raise the same exception the real client would raise for a specific code (for example, <code>130429<\/code> for the throughput limit) and check that the bot re-queues or gives up as expected.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Don&#8217;t mock-based tests hide changes made by Meta?<\/h3>\n\n\n\n<p>They can. That is why the staging layer exists, and why it is worth refreshing your fixtures from anonymized real events from time to time. Meta publishes changes in the platform changelog; follow it when you upgrade the Graph API version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Where did the test message fail if the webhook never arrived?<\/h3>\n\n\n\n<p>Start with the <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-webhook-not-working\/\">WhatsApp webhook not working<\/a> checklist: subscription to the <code>messages<\/code> field, a URL with valid HTTPS, a <code>200<\/code> response and the verify token.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Official sources consulted on November 24, 2026:<\/strong> <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/get-started\" target=\"_blank\" rel=\"noreferrer noopener\">Meta: getting started<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/webhooks\/create-webhook-endpoint\" target=\"_blank\" rel=\"noreferrer noopener\">Meta: create a webhook endpoint<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/webhooks\/reference\/messages\/status\" target=\"_blank\" rel=\"noreferrer noopener\">Meta: status webhook<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/webhooks\/set-up-whatsapp-echo-bot\" target=\"_blank\" rel=\"noreferrer noopener\">Meta: echo bot and webhook testing<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/messages\/text-messages\" target=\"_blank\" rel=\"noreferrer noopener\">Meta: text messages<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/messages\/interactive-reply-buttons-messages\" target=\"_blank\" rel=\"noreferrer noopener\">Meta: reply buttons<\/a>, <a href=\"https:\/\/developers.facebook.com\/docs\/whatsapp\/cloud-api\/support\/error-codes\" target=\"_blank\" rel=\"noreferrer noopener\">Meta: error codes<\/a>, <a href=\"https:\/\/pytest-django.readthedocs.io\/en\/latest\/helpers.html\" target=\"_blank\" rel=\"noreferrer noopener\">pytest-django: fixtures<\/a>, <a href=\"https:\/\/docs.vectalk.com.br\/concepts\/webhooks\">Vectalk: webhooks<\/a>, <a href=\"https:\/\/docs.vectalk.com.br\/authentication\">Vectalk: authentication<\/a>, <a href=\"https:\/\/docs.vectalk.com.br\/api-reference\/messages\/list\">Vectalk: list messages<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Webhook fixtures, flow tests with a fake sender, limit checks and a separate staging environment to test your bot without talking to real customers.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-2189","post","type-post","status-publish","format-standard","hentry","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Test a WhatsApp Bot: Automated Tests | Vectalk<\/title>\n<meta name=\"description\" content=\"Test WhatsApp bot flows on the official API: webhook fixtures, flow tests with a fake sender, Meta&#039;s test number and a separate staging setup.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Test a WhatsApp Bot: Automated Tests | Vectalk\" \/>\n<meta property=\"og:description\" content=\"Test WhatsApp bot flows on the official API: webhook fixtures, flow tests with a fake sender, Meta&#039;s test number and a separate staging setup.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Vectalk\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-24T19:30:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-24T19:30:38+00:00\" \/>\n<meta name=\"author\" content=\"wanderleyfcunha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"wanderleyfcunha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/test-whatsapp-bot-automated-tests\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/test-whatsapp-bot-automated-tests\\\/\"},\"author\":{\"name\":\"wanderleyfcunha\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/ff36ecd9d8257856f227f8e5d639db2b\"},\"headline\":\"How to test a WhatsApp bot: simulated payloads and automated tests\",\"datePublished\":\"2026-11-24T19:30:33+00:00\",\"dateModified\":\"2026-11-24T19:30:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/test-whatsapp-bot-automated-tests\\\/\"},\"wordCount\":1416,\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/test-whatsapp-bot-automated-tests\\\/\",\"url\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/test-whatsapp-bot-automated-tests\\\/\",\"name\":\"How to Test a WhatsApp Bot: Automated Tests | Vectalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#website\"},\"datePublished\":\"2026-11-24T19:30:33+00:00\",\"dateModified\":\"2026-11-24T19:30:38+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/ff36ecd9d8257856f227f8e5d639db2b\"},\"description\":\"Test WhatsApp bot flows on the official API: webhook fixtures, flow tests with a fake sender, Meta's test number and a separate staging setup.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/test-whatsapp-bot-automated-tests\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/test-whatsapp-bot-automated-tests\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/test-whatsapp-bot-automated-tests\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to test a WhatsApp bot: simulated payloads and automated tests\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/\",\"name\":\"Blog Vectalk\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/ff36ecd9d8257856f227f8e5d639db2b\",\"name\":\"wanderleyfcunha\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g\",\"caption\":\"wanderleyfcunha\"},\"sameAs\":[\"https:\\\/\\\/vectalk.com.br\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Test a WhatsApp Bot: Automated Tests | Vectalk","description":"Test WhatsApp bot flows on the official API: webhook fixtures, flow tests with a fake sender, Meta's test number and a separate staging setup.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/","og_locale":"en_US","og_type":"article","og_title":"How to Test a WhatsApp Bot: Automated Tests | Vectalk","og_description":"Test WhatsApp bot flows on the official API: webhook fixtures, flow tests with a fake sender, Meta's test number and a separate staging setup.","og_url":"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/","og_site_name":"Blog Vectalk","article_published_time":"2026-11-24T19:30:33+00:00","article_modified_time":"2026-11-24T19:30:38+00:00","author":"wanderleyfcunha","twitter_card":"summary_large_image","twitter_misc":{"Written by":"wanderleyfcunha","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/#article","isPartOf":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/"},"author":{"name":"wanderleyfcunha","@id":"https:\/\/vectalk.com.br\/blog\/#\/schema\/person\/ff36ecd9d8257856f227f8e5d639db2b"},"headline":"How to test a WhatsApp bot: simulated payloads and automated tests","datePublished":"2026-11-24T19:30:33+00:00","dateModified":"2026-11-24T19:30:38+00:00","mainEntityOfPage":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/"},"wordCount":1416,"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/","url":"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/","name":"How to Test a WhatsApp Bot: Automated Tests | Vectalk","isPartOf":{"@id":"https:\/\/vectalk.com.br\/blog\/#website"},"datePublished":"2026-11-24T19:30:33+00:00","dateModified":"2026-11-24T19:30:38+00:00","author":{"@id":"https:\/\/vectalk.com.br\/blog\/#\/schema\/person\/ff36ecd9d8257856f227f8e5d639db2b"},"description":"Test WhatsApp bot flows on the official API: webhook fixtures, flow tests with a fake sender, Meta's test number and a separate staging setup.","breadcrumb":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vectalk.com.br\/blog\/en\/test-whatsapp-bot-automated-tests\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vectalk.com.br\/blog\/"},{"@type":"ListItem","position":2,"name":"How to test a WhatsApp bot: simulated payloads and automated tests"}]},{"@type":"WebSite","@id":"https:\/\/vectalk.com.br\/blog\/#website","url":"https:\/\/vectalk.com.br\/blog\/","name":"Blog Vectalk","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vectalk.com.br\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/vectalk.com.br\/blog\/#\/schema\/person\/ff36ecd9d8257856f227f8e5d639db2b","name":"wanderleyfcunha","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21c37077f1731eb558973f27a7b647d55f72fde5200a843ac5f5345b247ea725?s=96&d=mm&r=g","caption":"wanderleyfcunha"},"sameAs":["https:\/\/vectalk.com.br\/blog"]}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts\/2189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/comments?post=2189"}],"version-history":[{"count":1,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts\/2189\/revisions"}],"predecessor-version":[{"id":2192,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts\/2189\/revisions\/2192"}],"wp:attachment":[{"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/media?parent=2189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/categories?post=2189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/tags?post=2189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}