{"id":710,"date":"2026-10-29T13:16:48","date_gmt":"2026-10-29T13:16:48","guid":{"rendered":"https:\/\/vectalk.com.br\/blog\/ai-chatbot-whatsapp-api\/"},"modified":"2026-10-29T13:16:50","modified_gmt":"2026-10-29T13:16:50","slug":"ai-chatbot-whatsapp-api","status":"publish","type":"post","link":"https:\/\/vectalk.com.br\/blog\/en\/ai-chatbot-whatsapp-api\/","title":{"rendered":"AI chatbot on the official WhatsApp Business API: architecture and code"},"content":{"rendered":"\n<p><em>Updated on October 29, 2026<\/em><\/p>\n\n\n\n<p>To connect a chatbot or AI agent to WhatsApp through the official API, you receive each message by webhook, return 200 right away, put the event in a queue and let a worker build the context, call the language model and send the reply through the API. The bot&#8217;s free-form replies can only go out inside the 24-hour window the customer opened, and Meta&#8217;s policy requires a clear path to a human agent. Meta&#8217;s terms also prohibit using the platform to offer general-purpose AI assistants as the main product, with exceptions in a few countries, Brazil among them.<\/p>\n\n\n\n<p>This guide shows the architecture, the rules that affect the bot and a working Node.js example using Vectalk, which passes through the same payloads and webhooks as Meta.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture: webhook, queue, LLM and reply<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-text\">Customer on WhatsApp\n      \u2502\n      \u25bc\nMeta \u2500\u2500POST\u2500\u2500\u25b6 Vectalk \u2500\u2500POST\u2500\u2500\u25b6 \/webhook (returns 200 and enqueues)\n                                     \u2502\n                                     \u25bc\n                                   Queue\n                                     \u2502\n                                     \u25bc\n                Worker: dedupe \u25b6 load history \u25b6 decide (bot or human)\n                                     \u2502\n                         \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n                         \u25bc                       \u25bc\n                   LLM writes reply         Human agent\n                         \u2502\n                         \u25bc\n             POST \/api\/messages (Vectalk) \u2500\u2500\u25b6 Meta \u2500\u2500\u25b6 Customer<\/code><\/pre>\n\n\n\n<p>Each piece has a clear job:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Component<\/th><th>Responsibility<\/th><th>Main concern<\/th><\/tr><\/thead><tbody><tr><td>Webhook<\/td><td>Receive the event, validate it and return 200<\/td><td>Don&#8217;t call the LLM inside the request<\/td><\/tr><tr><td>Queue<\/td><td>Decouple receiving from processing<\/td><td>Guarantee a retry if the worker crashes<\/td><\/tr><tr><td>Deduplication<\/td><td>Ignore repeated events by their <code>wamid<\/code> ID<\/td><td>Keep processed IDs for a few days<\/td><\/tr><tr><td>History<\/td><td>Build the conversation context by <code>wa_id<\/code><\/td><td>Cap the size to control cost and latency<\/td><\/tr><tr><td>Router<\/td><td>Decide whether the bot replies or the conversation is with a human<\/td><td>Respect the handoff state<\/td><\/tr><tr><td>LLM<\/td><td>Generate the reply within the business scope<\/td><td>A prompt with clear limits and a maximum response time<\/td><\/tr><tr><td>Sending<\/td><td>Call the API and store the sent message ID<\/td><td>Handle errors and check the 24-hour window<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Why the queue is mandatory<\/h3>\n\n\n\n<p>A language model can take several seconds to answer. Vectalk expects HTTP 200 in under 20 seconds and resends the event if it doesn&#8217;t get it, according to its <a href=\"https:\/\/docs.vectalk.com.br\/concepts\/webhooks\">webhooks documentation<\/a>. If the endpoint waits for the LLM, a spike in messages causes resends, duplicate replies and double cost. With the queue, the webhook only stores the event and responds.<\/p>\n\n\n\n<p>The article on <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-webhooks\/\">WhatsApp API webhooks<\/a> covers the event format, deduplication and status handling, and <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-webhook-signature-validation\/\">webhook signature validation<\/a> shows how to check <code>X-Hub-Signature-256<\/code> before enqueueing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Mark as read and show &#8220;typing&#8221;<\/h3>\n\n\n\n<p>The Cloud API lets you mark the incoming message as read and show the typing indicator in the same call. According to the <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/typing-indicators\" target=\"_blank\" rel=\"noreferrer noopener\">typing indicators documentation<\/a>, the indicator disappears when you reply or after 25 seconds, whichever comes first. Meta recommends showing it only if you are actually going to reply.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-json\">{\n  \"messaging_product\": \"whatsapp\",\n  \"status\": \"read\",\n  \"message_id\": \"wamid.HBgLNTUx...\",\n  \"typing_indicator\": { \"type\": \"text\" }\n}<\/code><\/pre>\n\n\n\n<p>On Vectalk, this call goes to <code>POST \/api\/messages<\/code>, the same endpoint documented for marking messages as read.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The 24-hour window defines what the bot can send<\/h2>\n\n\n\n<p>When the customer sends a message, a 24-hour customer service window opens, and it renews with each new message from them. Inside it, the bot can reply with free-form text, media and interactive messages. Outside it, only approved templates (see Meta&#8217;s page on <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/messages\/send-messages\" target=\"_blank\" rel=\"noreferrer noopener\">service messages and the customer service window<\/a>).<\/p>\n\n\n\n<p>In practice, this changes how you design the agent:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The bot is reactive.<\/strong> It answers what the customer asked. To reach out again after 24 hours, the system needs a template, not text generated by the LLM.<\/li>\n\n\n<li><strong>Slow replies can miss the window.<\/strong> If the bot depends on a slow process (document analysis, a call to another system), record the time of the customer&#8217;s last message and check it before sending.<\/li>\n\n\n<li><strong>Buttons and lists help the LLM.<\/strong> Instead of asking the customer to type &#8220;1&#8221; or &#8220;2&#8221;, the bot can send clickable options. See <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-interactive-messages-api\/\">WhatsApp interactive messages<\/a>.<\/li>\n\n<\/ul>\n\n\n\n<p>The article on the <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-24-hour-customer-service-window\/\">WhatsApp 24-hour customer service window<\/a> details the rules for opening and renewing it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How much each bot reply costs<\/h3>\n\n\n\n<p>Free-form replies inside the window are service messages. Since October 1, 2026, each business phone number gets 1,000 free service messages per month, and Meta charges from the 1,001st onward, according to the <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">pricing page<\/a>. For recipients in Brazil, the service rate is R$ 0.0350 (Brazilian reais) per delivered message; rates for other markets are in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-pricing-by-country\/\">WhatsApp API pricing by country<\/a>. A bot that replies in three short messages costs three times as much as one that replies in a single message, so it pays to combine the answer.<\/p>\n\n\n\n<p>On top of that comes the cost of the language model itself, which depends on the provider and the size of the context.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Handoff to a human<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/business.whatsapp.com\/policy\" target=\"_blank\" rel=\"noreferrer noopener\">WhatsApp Business Messaging Policy<\/a> allows automation inside the 24-hour window but requires prompt, clear and direct escalation paths. The options it lists include transferring to a human agent in the conversation, a phone number, email, website support, a store visit or a support form.<\/p>\n\n\n\n<p>A customer service bot needs at least three handoff triggers:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Explicit request.<\/strong> The customer types &#8220;agent&#8221;, &#8220;talk to a person&#8221; or taps a human help button.<\/li>\n\n\n<li><strong>Low confidence.<\/strong> The LLM signals it doesn&#8217;t know the answer or the topic is outside the defined scope.<\/li>\n\n\n<li><strong>Sensitive topic.<\/strong> A complaint, cancellation, disputed charge or any topic the business decides to handle only with people.<\/li>\n\n<\/ol>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Conversation state<\/th><th>Who replies<\/th><th>How it leaves the state<\/th><\/tr><\/thead><tbody><tr><td><code>bot<\/code><\/td><td>AI agent<\/td><td>Handoff trigger<\/td><\/tr><tr><td><code>waiting_human<\/code><\/td><td>No one replies automatically; the bot announces the wait time only once<\/td><td>An agent takes over<\/td><\/tr><tr><td><code>human<\/code><\/td><td>Agent, through the customer service tool<\/td><td>The agent closes it or the conversation goes idle<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>If the number uses <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-coexistence\/\">coexistence<\/a>, the agent can reply from the WhatsApp Business app on their phone. Messages sent from the app reach your system as echo events, and the router can use them to switch the conversation to <code>human<\/code> automatically, so the bot doesn&#8217;t talk over the agent. For several agents on the same number, see <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-multi-agent-api\/\">multi-agent WhatsApp with the API<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Meta allows for AI chatbots<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/www.facebook.com\/legal\/Meta-Terms-for-WhatsApp-Business-Platform\" target=\"_blank\" rel=\"noreferrer noopener\">Meta Terms for WhatsApp Business Platform<\/a>, in clause 4.7, deal with &#8220;AI Providers&#8221;: providers and developers of artificial intelligence or machine learning technologies, such as large language models, generative AI platforms and general-purpose AI assistants, as Meta determines. They are prohibited from using the platform to offer those technologies when they are the primary functionality rather than incidental or ancillary.<\/p>\n\n\n\n<p>What this means for bot builders:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The business&#8217;s own customer service bot.<\/strong> An agent that answers questions about orders, books appointments or explains the company&#8217;s products uses AI as a tool for customer service. Meta decides each case, but this is not the use the terms target.<\/li>\n\n\n<li><strong>General-purpose assistant as a product.<\/strong> Offering a &#8220;ChatGPT on WhatsApp&#8221; to the public, where talking to the AI is the service itself, is the prohibited case, except in the countries where Meta is legally required to allow it.<\/li>\n\n\n<li><strong>Brazil.<\/strong> The <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/pricing\/ai-providers\" target=\"_blank\" rel=\"noreferrer noopener\">AI Providers pricing page<\/a> lists Brazil (+55) among the markets where AI Providers can send service messages since March 11, 2026, and Meta charges them at the published rates. Other listed markets include Italy and 29 European markets, plus T\u00fcrkiye since October 15, 2026. In these sends, the status webhook shows the pricing category <code>general_purpose_ai<\/code>. This rule applies only to AI Providers; pricing for other businesses doesn&#8217;t change.<\/li>\n\n\n<li><strong>Training data.<\/strong> The terms prohibit using platform data to create, develop, train or improve AI models. They allow using that data to fine-tune a model for the business&#8217;s exclusive use, as long as it isn&#8217;t used for other models. Review your LLM provider&#8217;s terms on retention and training.<\/li>\n\n<\/ul>\n\n\n\n<p>The terms were last updated on September 23, 2026. Reread the clause before launching a product in which AI is the core of the offer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Node.js example<\/h2>\n\n\n\n<p>The example below uses Express, an in-memory queue and the Vectalk API. In production, replace the queue with a persistent service (Redis, SQS, RabbitMQ) and the <code>Map<\/code> with a database. The <code>generateReply<\/code> function is where your LLM provider&#8217;s SDK goes. For a step-by-step version with an actual model call, see <a href=\"https:\/\/vectalk.com.br\/blog\/en\/chatgpt-whatsapp-business-api\/\">connecting ChatGPT to the WhatsApp Business API<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-js\">import express from 'express';\n\nconst VECTALK = 'https:\/\/apis.vectalk.com.br\/api\/messages';\nconst TOKEN = process.env.VECTALK_TOKEN; \/\/ instance token\nconst WINDOW_MS = 24 * 60 * 60 * 1000;\nconst HUMAN_TRIGGERS = \/\\b(agent|human|person|complain|cancel)\\b\/i;\n\nconst app = express();\napp.use(express.json());\n\nconst queue = [];\nconst processed = new Set();        \/\/ wamid IDs already handled\nconst conversations = new Map();    \/\/ wa_id -&gt; { state, history, lastInbound }\n\n\/\/ 1. Webhook: validate, enqueue and return 200\napp.post('\/webhook', (req, res) =&gt; {\n  for (const entry of req.body.entry ?? []) {\n    for (const change of entry.changes ?? []) {\n      for (const msg of change.value?.messages ?? []) queue.push(msg);\n    }\n  }\n  res.sendStatus(200);\n});\n\n\/\/ 2. Send through Vectalk (same payload as Meta)\nasync function send(payload) {\n  const r = await fetch(VECTALK, {\n    method: 'POST',\n    headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application\/json' },\n    body: JSON.stringify({ messaging_product: 'whatsapp', ...payload }),\n  });\n  if (!r.ok) throw new Error(`Send failed: ${r.status} ${await r.text()}`);\n  return r.json();\n}\n\n\/\/ 3. LLM integration point\nasync function generateReply(history) {\n  \/\/ Call your provider's SDK here, with a system prompt that limits\n  \/\/ the scope to your business and asks it to answer \"HANDOFF\" when unsure.\n  throw new Error('Implement the LLM call');\n}\n\n\/\/ 4. Worker\nasync function processMessage(msg) {\n  if (processed.has(msg.id)) return;\n  processed.add(msg.id);\n\n  const c = conversations.get(msg.from) ?? { state: 'bot', history: [], lastInbound: 0 };\n  c.lastInbound = Number(msg.timestamp) * 1000;\n  conversations.set(msg.from, c);\n\n  if (c.state !== 'bot') return; \/\/ a human has the conversation: the bot stays silent\n\n  if (msg.type !== 'text') {\n    await send({ to: msg.from, type: 'text', text: { body: 'For now I only understand text. Could you type your question?' } });\n    return;\n  }\n\n  const text = msg.text.body;\n  c.history.push({ role: 'user', content: text });\n  c.history = c.history.slice(-20); \/\/ cap the context\n\n  if (HUMAN_TRIGGERS.test(text)) return handOff(msg.from, c);\n\n  await send({ status: 'read', message_id: msg.id, typing_indicator: { type: 'text' } });\n\n  const reply = await generateReply(c.history);\n  if (reply.trim() === 'HANDOFF') return handOff(msg.from, c);\n\n  if (Date.now() - c.lastInbound &gt; WINDOW_MS) return; \/\/ window closed: a template is needed\n\n  await send({ to: msg.from, type: 'text', text: { body: reply } });\n  c.history.push({ role: 'assistant', content: reply });\n}\n\nasync function handOff(waId, c) {\n  c.state = 'waiting_human';\n  await send({ to: waId, type: 'text', text: { body: \"I'm bringing in someone from our team. They'll pick up right here shortly.\" } });\n  \/\/ Notify your customer service tool (ticket queue, Slack, CRM).\n}\n\nsetInterval(async () =&gt; {\n  const msg = queue.shift();\n  if (!msg) return;\n  try { await processMessage(msg); } catch (e) { console.error(e); }\n}, 50);\n\napp.listen(3000);<\/code><\/pre>\n\n\n\n<p>What the example already handles and what&#8217;s missing for production:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Handles:<\/strong> an immediate webhook response, deduplication by <code>wamid<\/code>, handoff state, a context cap, the window check and the typing indicator.<\/li>\n\n\n<li><strong>Missing:<\/strong> a persistent queue with retries, a database for history and state, a timeout on the LLM call, cost tracking from the status webhook, and a dashboard for agents to take over the conversation and hand it back to the bot. Vectalk doesn&#8217;t provide a customer service inbox, so that dashboard is your own tool or a CRM integrated with the webhooks.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best practices for the agent<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Closed scope.<\/strong> The system prompt should state what the bot does and doesn&#8217;t do. Prices, deadlines and policies should come from your system&#8217;s data, not from the model&#8217;s memory.<\/li>\n\n\n<li><strong>Short replies.<\/strong> On WhatsApp, a three-line message works better than a long text. It also reduces the number of billed messages.<\/li>\n\n\n<li><strong>Identify the bot.<\/strong> Make it clear the customer is talking to a virtual assistant and how to reach a person.<\/li>\n\n\n<li><strong>Log everything.<\/strong> Store the question, the answer, the model used and the response time. Without that, you can&#8217;t audit a wrong answer.<\/li>\n\n\n<li><strong>Test with real messages.<\/strong> Voice notes, photos of receipts and stickers arrive every day. Decide what the bot does with each type before going to production.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Can I use any LLM with the official API?<\/h3>\n\n\n\n<p>The WhatsApp API doesn&#8217;t restrict the model you run on your server. What Meta&#8217;s terms regulate is the use: AI supporting the business&#8217;s customer service is different from offering a general-purpose assistant as the main product.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can the bot send the first message to the customer?<\/h3>\n\n\n\n<p>Not with free-form text. To start a conversation or reach out again after 24 hours, you need an approved template. See <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-message-templates\/\">WhatsApp API message templates<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I stop the bot from replying twice to the same message?<\/h3>\n\n\n\n<p>Store the <code>wamid<\/code> ID of every processed message and ignore repeats. Webhook resends happen whenever the endpoint is slow or fails.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can the bot reply to voice notes?<\/h3>\n\n\n\n<p>The webhook delivers the media ID, which you download through the media API and transcribe with the service of your choice. Transcription and its cost are on you. <a href=\"https:\/\/vectalk.com.br\/blog\/en\/download-media-whatsapp-webhook\/\">Downloading media from the webhook<\/a> shows the download step.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Do I need any special registration with Meta to use AI?<\/h3>\n\n\n\n<p>For the business&#8217;s own customer service bot, the documentation we checked doesn&#8217;t describe any extra registration. If your product is a general-purpose AI assistant, read clause 4.7 of the terms and the AI Providers page before you start.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Get started with Vectalk<\/h2>\n\n\n\n<p>With Vectalk, your bot receives the same webhooks as Meta and sends with the same payloads, using one token for all accounts. You don&#8217;t add a card at Meta: you pay a monthly fee and keep a prepaid balance, and each delivered message is deducted from it. Coexistence lets your human team keep using the app. Create your account at <a href=\"https:\/\/apps.vectalk.com.br\/register\">apps.vectalk.com.br\/register<\/a> and read the <a href=\"https:\/\/docs.vectalk.com.br\/\">documentation<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Sources checked on October 29, 2026:<\/strong> <a href=\"https:\/\/www.facebook.com\/legal\/Meta-Terms-for-WhatsApp-Business-Platform\" target=\"_blank\" rel=\"noreferrer noopener\">Meta Terms for WhatsApp Business Platform<\/a> (updated on September 23, 2026), <a href=\"https:\/\/business.whatsapp.com\/policy\" target=\"_blank\" rel=\"noreferrer noopener\">WhatsApp Business Messaging Policy<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/pricing\/ai-providers\" target=\"_blank\" rel=\"noreferrer noopener\">Pricing for AI Providers<\/a> (updated on October 15, 2026), <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">Pricing on the WhatsApp Business Platform<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/messages\/send-messages\" target=\"_blank\" rel=\"noreferrer noopener\">Service messages and customer service window<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/typing-indicators\" target=\"_blank\" rel=\"noreferrer noopener\">Typing indicators<\/a>, <a href=\"https:\/\/docs.vectalk.com.br\/concepts\/webhooks\">Webhooks in the Vectalk documentation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to connect an AI chatbot or agent to the official WhatsApp Business API: architecture, the 24-hour window, human handoff, Meta&#8217;s rules for AI and working Node.js code.<\/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-710","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>AI Chatbot on WhatsApp API: Architecture &amp; Node.js | Vectalk<\/title>\n<meta name=\"description\" content=\"AI chatbot on the WhatsApp Business API: webhook, queue and LLM architecture, the 24-hour window, human handoff, Meta&#039;s AI rules and a Node.js example.\" \/>\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\/ai-chatbot-whatsapp-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AI Chatbot on WhatsApp API: Architecture &amp; Node.js | Vectalk\" \/>\n<meta property=\"og:description\" content=\"AI chatbot on the WhatsApp Business API: webhook, queue and LLM architecture, the 24-hour window, human handoff, Meta&#039;s AI rules and a Node.js example.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vectalk.com.br\/blog\/en\/ai-chatbot-whatsapp-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Vectalk\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-29T13:16:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-29T13:16:50+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\\\/ai-chatbot-whatsapp-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/ai-chatbot-whatsapp-api\\\/\"},\"author\":{\"name\":\"wanderleyfcunha\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/ff36ecd9d8257856f227f8e5d639db2b\"},\"headline\":\"AI chatbot on the official WhatsApp Business API: architecture and code\",\"datePublished\":\"2026-10-29T13:16:48+00:00\",\"dateModified\":\"2026-10-29T13:16:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/ai-chatbot-whatsapp-api\\\/\"},\"wordCount\":1830,\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/ai-chatbot-whatsapp-api\\\/\",\"url\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/ai-chatbot-whatsapp-api\\\/\",\"name\":\"AI Chatbot on WhatsApp API: Architecture & Node.js | Vectalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#website\"},\"datePublished\":\"2026-10-29T13:16:48+00:00\",\"dateModified\":\"2026-10-29T13:16:50+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/ff36ecd9d8257856f227f8e5d639db2b\"},\"description\":\"AI chatbot on the WhatsApp Business API: webhook, queue and LLM architecture, the 24-hour window, human handoff, Meta's AI rules and a Node.js example.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/ai-chatbot-whatsapp-api\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/ai-chatbot-whatsapp-api\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/ai-chatbot-whatsapp-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI chatbot on the official WhatsApp Business API: architecture and code\"}]},{\"@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":"AI Chatbot on WhatsApp API: Architecture & Node.js | Vectalk","description":"AI chatbot on the WhatsApp Business API: webhook, queue and LLM architecture, the 24-hour window, human handoff, Meta's AI rules and a Node.js example.","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\/ai-chatbot-whatsapp-api\/","og_locale":"en_US","og_type":"article","og_title":"AI Chatbot on WhatsApp API: Architecture & Node.js | Vectalk","og_description":"AI chatbot on the WhatsApp Business API: webhook, queue and LLM architecture, the 24-hour window, human handoff, Meta's AI rules and a Node.js example.","og_url":"https:\/\/vectalk.com.br\/blog\/en\/ai-chatbot-whatsapp-api\/","og_site_name":"Blog Vectalk","article_published_time":"2026-10-29T13:16:48+00:00","article_modified_time":"2026-10-29T13:16:50+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\/ai-chatbot-whatsapp-api\/#article","isPartOf":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/ai-chatbot-whatsapp-api\/"},"author":{"name":"wanderleyfcunha","@id":"https:\/\/vectalk.com.br\/blog\/#\/schema\/person\/ff36ecd9d8257856f227f8e5d639db2b"},"headline":"AI chatbot on the official WhatsApp Business API: architecture and code","datePublished":"2026-10-29T13:16:48+00:00","dateModified":"2026-10-29T13:16:50+00:00","mainEntityOfPage":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/ai-chatbot-whatsapp-api\/"},"wordCount":1830,"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/vectalk.com.br\/blog\/en\/ai-chatbot-whatsapp-api\/","url":"https:\/\/vectalk.com.br\/blog\/en\/ai-chatbot-whatsapp-api\/","name":"AI Chatbot on WhatsApp API: Architecture & Node.js | Vectalk","isPartOf":{"@id":"https:\/\/vectalk.com.br\/blog\/#website"},"datePublished":"2026-10-29T13:16:48+00:00","dateModified":"2026-10-29T13:16:50+00:00","author":{"@id":"https:\/\/vectalk.com.br\/blog\/#\/schema\/person\/ff36ecd9d8257856f227f8e5d639db2b"},"description":"AI chatbot on the WhatsApp Business API: webhook, queue and LLM architecture, the 24-hour window, human handoff, Meta's AI rules and a Node.js example.","breadcrumb":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/ai-chatbot-whatsapp-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vectalk.com.br\/blog\/en\/ai-chatbot-whatsapp-api\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vectalk.com.br\/blog\/en\/ai-chatbot-whatsapp-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vectalk.com.br\/blog\/"},{"@type":"ListItem","position":2,"name":"AI chatbot on the official WhatsApp Business API: architecture and code"}]},{"@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\/710","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=710"}],"version-history":[{"count":1,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts\/710\/revisions"}],"predecessor-version":[{"id":712,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts\/710\/revisions\/712"}],"wp:attachment":[{"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/media?parent=710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/categories?post=710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/tags?post=710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}