{"id":2243,"date":"2026-11-24T19:34:08","date_gmt":"2026-11-24T19:34:08","guid":{"rendered":"https:\/\/vectalk.com.br\/blog\/claude-whatsapp-business-api\/"},"modified":"2026-11-24T19:34:12","modified_gmt":"2026-11-24T19:34:12","slug":"claude-whatsapp-business-api","status":"publish","type":"post","link":"https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/","title":{"rendered":"Claude (Anthropic) + WhatsApp Business API: AI customer service"},"content":{"rendered":"\n<p><em>Updated on November 24, 2026<\/em><\/p>\n\n\n\n<p>To answer WhatsApp customers with Claude, you receive the message through the official API webhook, send that conversation&#8217;s history to Anthropic&#8217;s Messages API (<code>client.messages.create<\/code>) and return the reply with a Cloud API send call. When Claude needs data from your system, such as an order status, it asks to use a tool: your code runs the lookup and sends the result back so Claude can finish the answer. Free-form replies can only go out inside the 24-hour window opened by the customer.<\/p>\n\n\n\n<p>Below you&#8217;ll find the full code in Python and the same loop in Node.js, using Anthropic&#8217;s official SDK.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Claude for customer service vs. ChatGPT vs. MCP<\/h2>\n\n\n\n<p>Two related articles cover AI on WhatsApp. This one takes a third angle:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Article<\/th><th>Who talks to the AI<\/th><th>What the AI does<\/th><\/tr><\/thead><tbody><tr><td><a href=\"https:\/\/vectalk.com.br\/blog\/en\/chatgpt-whatsapp-business-api\/\">ChatGPT on the WhatsApp Business API<\/a><\/td><td>The customer, on WhatsApp<\/td><td>Replies through OpenAI&#8217;s Responses API<\/td><\/tr><tr><td><a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-mcp-server\/\">WhatsApp MCP server<\/a><\/td><td>Someone on your team, in an AI app<\/td><td>The agent sends WhatsApp messages as a tool<\/td><\/tr><tr><td>This article<\/td><td>The customer, on WhatsApp<\/td><td>Claude replies and looks up your system through tools<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>With MCP, WhatsApp is one of the agent&#8217;s tools. Here, WhatsApp is the channel, and Claude&#8217;s tools query your ERP, CRM or calendar.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Which Claude model to use<\/h2>\n\n\n\n<p><a href=\"https:\/\/platform.claude.com\/docs\/en\/models\/overview\" target=\"_blank\" rel=\"noreferrer noopener\">Anthropic&#8217;s models page<\/a>, checked on November 24, 2026, lists these current models:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Model<\/th><th>API ID<\/th><th>Anthropic&#8217;s description<\/th><\/tr><\/thead><tbody><tr><td>Claude Opus 5.5<\/td><td><code>claude-opus-5-5<\/code><\/td><td>Long-running agentic work and knowledge work<\/td><\/tr><tr><td>Claude Sonnet 5.5<\/td><td><code>claude-sonnet-5-5<\/code><\/td><td>The best combination of speed and intelligence<\/td><\/tr><tr><td>Claude Haiku 5.5<\/td><td><code>claude-haiku-5-5<\/code><\/td><td>High-volume, latency-sensitive tasks: classification, extraction, routing<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The example uses <code>claude-sonnet-5-5<\/code>, because WhatsApp customers expect an answer within seconds. Keep the ID in an environment variable (<code>CLAUDE_MODEL<\/code>) so you can try Haiku or Opus, or switch when Anthropic ships a new model, without touching the code. Per-token prices vary by model: see <a href=\"https:\/\/platform.claude.com\/docs\/en\/about-claude\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">Anthropic&#8217;s pricing page<\/a> and our guide to <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-ai-chatbot-cost-per-conversation\/\">AI cost per conversation<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The flow in 5 steps<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Step<\/th><th>What happens<\/th><th>Where<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>The customer sends a message and the webhook reaches your server<\/td><td>Meta \u2192 provider \u2192 your server<\/td><\/tr><tr><td>2<\/td><td>You return 200 right away and process in the background<\/td><td>Webhook<\/td><\/tr><tr><td>3<\/td><td>You load that <code>wa_id<\/code>&#8216;s history from your database<\/td><td>Database<\/td><\/tr><tr><td>4<\/td><td>You call the Messages API; on <code>tool_use<\/code>, you run the tool and call again<\/td><td>Anthropic + your system<\/td><\/tr><tr><td>5<\/td><td>With the window open, the final text goes back to the customer<\/td><td><code>POST \/messages<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The Messages API is <em>stateless<\/em>: according to the <a href=\"https:\/\/platform.claude.com\/docs\/en\/build-with-claude\/working-with-messages\" target=\"_blank\" rel=\"noreferrer noopener\">Messages documentation<\/a>, you always send the full conversation history. Your database is what remembers the customer, keyed by <code>wa_id<\/code> (the <code>from<\/code> field of the incoming message). To store and export those conversations, see <a href=\"https:\/\/vectalk.com.br\/blog\/en\/save-whatsapp-api-chat-history\/\">how to save WhatsApp API chat history<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Tool use in one minute<\/h2>\n\n\n\n<p>Tools are functions you describe to Claude with <code>name<\/code>, <code>description<\/code> and <code>input_schema<\/code> (a JSON Schema). Per the <a href=\"https:\/\/platform.claude.com\/docs\/en\/agents-and-tools\/tool-use\/overview\" target=\"_blank\" rel=\"noreferrer noopener\">tool use documentation<\/a>, the cycle goes like this:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>You send the question along with the <code>tools<\/code> list.<\/li>\n\n\n<li>If Claude decides to use a tool, the response comes back with <code>stop_reason: \"tool_use\"<\/code> and one or more <code>tool_use<\/code> blocks (with <code>id<\/code>, <code>name<\/code> and <code>input<\/code>).<\/li>\n\n\n<li>You run each tool and call again: the earlier messages, the response <code>content<\/code> as an <code>assistant<\/code> message (unchanged), and a <code>user<\/code> message with one <code>tool_result<\/code> per <code>tool_use<\/code>.<\/li>\n\n\n<li>If a tool failed, the <code>tool_result<\/code> carries <code>is_error: true<\/code> and a clear error message.<\/li>\n\n\n<li>Repeat while you get <code>tool_use<\/code>. When you get <code>end_turn<\/code>, the text is ready.<\/li>\n\n<\/ol>\n\n\n\n<p>Per the <a href=\"https:\/\/platform.claude.com\/docs\/en\/agents-and-tools\/tool-use\/handle-tool-calls\" target=\"_blank\" rel=\"noreferrer noopener\">page on handling tool calls<\/a>, the <code>tool_result<\/code> blocks must come right after the message with the <code>tool_use<\/code> blocks and first in the <code>user<\/code> message content, and the same <code>tools<\/code> list goes in every call.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Full Python code<\/h2>\n\n\n\n<p>The example uses FastAPI, the <code>anthropic<\/code> SDK and sending through Vectalk, which accepts the same JSON as the Cloud API. With an instance token, the sending number is resolved automatically; with an organization token, include <code>phone_number_id<\/code> in the body. If you integrate directly with Meta, change the URL to <code>https:\/\/graph.facebook.com\/v27.0\/&lt;PHONE_NUMBER_ID&gt;\/messages<\/code> and use your Meta token.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-bash\">pip install anthropic fastapi uvicorn requests\nexport ANTHROPIC_API_KEY=\"your-anthropic-key\"\nexport CLAUDE_MODEL=\"claude-sonnet-5-5\"\nexport VECTALK_TOKEN=\"your-instance-token\"\nuvicorn bot:app --port 8000<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-python\">import json\nimport os\nimport time\n\nimport anthropic\nimport requests\nfrom fastapi import BackgroundTasks, FastAPI, Request\n\nMODEL = os.environ.get(\"CLAUDE_MODEL\", \"claude-sonnet-5-5\")\nSEND_URL = \"https:\/\/apis.vectalk.com.br\/api\/messages\"\nVECTALK_TOKEN = os.environ[\"VECTALK_TOKEN\"]  # instance token\nWINDOW_SECONDS = 24 * 60 * 60\nMAX_MESSAGES = 20  # history messages sent to the model\nMAX_ROUNDS = 5     # cap on tool calls per reply\n\nclient = anthropic.Anthropic()  # reads ANTHROPIC_API_KEY from the environment\napp = FastAPI()\n\nSYSTEM = \"\"\"You are the WhatsApp assistant for Example Store.\n- Reply in English, in up to 3 short sentences, without markdown.\n- Only talk about the store's orders, deliveries, returns and products.\n- For order status, use get_order. Never make up dates or amounts.\n- If the customer asks for a person, complains, asks to cancel or for a refund,\n  or if you don't know the answer, use transfer_to_human.\"\"\"\n\nTOOLS = [\n    {\n        \"name\": \"get_order\",\n        \"description\": \"Looks up the status and delivery estimate of an order \"\n                       \"from the customer in this conversation. Use it when they ask about an order.\",\n        \"input_schema\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"order_number\": {\"type\": \"string\", \"description\": \"Order number, e.g. 48213\"}\n            },\n            \"required\": [\"order_number\"],\n            \"additionalProperties\": False,\n        },\n        \"strict\": True,\n    },\n    {\n        \"name\": \"transfer_to_human\",\n        \"description\": \"Hands the conversation over to a human agent.\",\n        \"input_schema\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"reason\": {\"type\": \"string\", \"description\": \"Short summary for the agent\"}\n            },\n            \"required\": [\"reason\"],\n            \"additionalProperties\": False,\n        },\n        \"strict\": True,\n    },\n]\n\n# In production, replace with a database (Postgres, Redis) and a persistent queue.\nconversations = {}  # wa_id -&gt; {\"state\", \"history\", \"last_inbound\"}\nprocessed = set()   # wamids already handled\n\n\ndef load(wa_id):\n    return conversations.setdefault(\n        wa_id, {\"state\": \"bot\", \"history\": [], \"last_inbound\": 0}\n    )\n\n\ndef send(body):\n    r = requests.post(\n        SEND_URL,\n        headers={\"Authorization\": f\"Bearer {VECTALK_TOKEN}\"},\n        json={\"messaging_product\": \"whatsapp\", **body},\n        timeout=15,\n    )\n    r.raise_for_status()\n    return r.json()\n\n\ndef send_text(wa_id, text):\n    return send({\"to\": wa_id, \"type\": \"text\", \"text\": {\"body\": text}})\n\n\ndef window_open(conversation):\n    return time.time() - conversation[\"last_inbound\"] &lt; WINDOW_SECONDS\n\n\ndef find_order(number, wa_id):\n    # Query your ERP filtering by phone (wa_id), never by order number alone.\n    if number == \"48213\":\n        return {\"order\": number, \"status\": \"in transit\", \"estimate\": \"2026-11-28\"}\n    return None\n\n\ndef notify_agents(wa_id, reason):\n    print(f\"Handoff {wa_id}: {reason}\")  # ticket queue, CRM, Slack...\n\n\ndef run_tool(block, wa_id, conversation):\n    if block.name == \"get_order\":\n        order = find_order(block.input[\"order_number\"], wa_id)\n        if order is None:\n            return \"Order not found for this customer.\", True\n        return json.dumps(order), False\n    if block.name == \"transfer_to_human\":\n        conversation[\"state\"] = \"human\"\n        notify_agents(wa_id, block.input[\"reason\"])\n        return \"Transferred. Tell the customer a person will take over.\", False\n    return f\"Unknown tool: {block.name}\", True\n\n\ndef ask_claude(wa_id, conversation):\n    messages = list(conversation[\"history\"])  # the loop appends tool blocks\n    for _ in range(MAX_ROUNDS):\n        response = client.messages.create(\n            model=MODEL,\n            max_tokens=16000,\n            system=SYSTEM,\n            tools=TOOLS,\n            output_config={\"effort\": \"low\"},  # lower latency for simple chat\n            messages=messages,\n        )\n        if response.stop_reason == \"tool_use\":\n            messages.append({\"role\": \"assistant\", \"content\": response.content})\n            results = []\n            for block in response.content:\n                if block.type == \"tool_use\":\n                    content, failed = run_tool(block, wa_id, conversation)\n                    results.append({\n                        \"type\": \"tool_result\",\n                        \"tool_use_id\": block.id,\n                        \"content\": content,\n                        \"is_error\": failed,\n                    })\n            messages.append({\"role\": \"user\", \"content\": results})\n            continue\n        if response.stop_reason == \"end_turn\":\n            text = \"\".join(b.text for b in response.content if b.type == \"text\")\n            return text.strip() or None\n        return None  # refusal, max_tokens, etc.: a person takes over\n    return None\n\n\ndef trim(history):\n    h = history[-MAX_MESSAGES:]\n    while h and h[0][\"role\"] != \"user\":  # the first message must be from the user\n        h = h[1:]\n    return h\n\n\ndef process(msg):\n    if msg[\"id\"] in processed:\n        return\n    processed.add(msg[\"id\"])\n    wa_id = msg[\"from\"]\n    conversation = load(wa_id)\n    conversation[\"last_inbound\"] = int(msg[\"timestamp\"])\n\n    if conversation[\"state\"] != \"bot\":\n        return  # a human has taken over\n    if msg[\"type\"] != \"text\":\n        send_text(wa_id, \"For now I can only read text. Could you type your question?\")\n        return\n\n    # Mark as read and show \"typing...\" while Claude replies\n    send({\"status\": \"read\", \"message_id\": msg[\"id\"], \"typing_indicator\": {\"type\": \"text\"}})\n    conversation[\"history\"].append({\"role\": \"user\", \"content\": msg[\"text\"][\"body\"]})\n\n    try:\n        text = ask_claude(wa_id, conversation)\n    except anthropic.APIError as e:\n        print(\"Claude failed:\", e)\n        text = None\n    if text is None:\n        conversation[\"state\"] = \"human\"\n        notify_agents(wa_id, \"model failure or refusal\")\n        text = \"I'm bringing in someone from our team to continue here.\"\n\n    if not window_open(conversation):\n        return  # the window closed while processing: templates only\n\n    send_text(wa_id, text)\n    conversation[\"history\"].append({\"role\": \"assistant\", \"content\": text})\n    conversation[\"history\"] = trim(conversation[\"history\"])\n\n\n@app.post(\"\/webhook\")\nasync def webhook(request: Request, tasks: BackgroundTasks):\n    body = await request.json()\n    for entry in body.get(\"entry\", []):\n        for change in entry.get(\"changes\", []):\n            for msg in change.get(\"value\", {}).get(\"messages\", []):\n                tasks.add_task(process, msg)\n    return {\"ok\": True}<\/code><\/pre>\n\n\n\n<p>Things worth noticing in the code:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Immediate webhook response.<\/strong> With tools, a reply takes two or more calls to Claude. On Vectalk, the endpoint must return HTTP 200 within 20 seconds or the event is resent, according to the <a href=\"https:\/\/docs.vectalk.com.br\/concepts\/webhooks\">webhooks documentation<\/a>. That&#8217;s why processing runs in <code>BackgroundTasks<\/code> and the <code>wamid<\/code> deduplicates retries.<\/li>\n\n\n<li><strong>Round limit.<\/strong> <code>MAX_ROUNDS<\/code> keeps a repeating tool error from turning into an expensive loop.<\/li>\n\n\n<li><strong>Failure means handoff.<\/strong> An API error, a refusal (<code>stop_reason: \"refusal\"<\/code>) or a cut-off reply (<code>max_tokens<\/code>) hand the conversation to a person instead of leaving the customer without an answer.<\/li>\n\n\n<li><strong>Generous <code>max_tokens<\/code>.<\/strong> Claude may reason before replying, and that counts toward <code>max_tokens<\/code>. Reply length is controlled by the <code>system<\/code> prompt.<\/li>\n\n\n<li><strong>Per-contact ordering.<\/strong> In production, use a queue with one consumer per <code>wa_id<\/code> so two back-to-back messages don&#8217;t run in parallel.<\/li>\n\n<\/ul>\n\n\n\n<p>The &#8220;typing&#8230;&#8221; indicator uses the Cloud API <code>typing_indicator<\/code>: per the <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/typing-indicators\" target=\"_blank\" rel=\"noreferrer noopener\">typing indicators documentation<\/a>, it disappears when you reply or after 25 seconds, whichever comes first.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why the history stores only text<\/h3>\n\n\n\n<p>Within a single reply, the loop sends Claude&#8217;s <code>content<\/code> back unchanged, as the documentation requires. In the database, the example saves only each exchange&#8217;s question and final answer: the record stays readable and easy to audit and trim (<code>trim<\/code> keeps the last 20 messages, always starting with a user message). If Claude needs the data again, it calls the tool again.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The same logic in Node.js<\/h2>\n\n\n\n<p>With the <code>@anthropic-ai\/sdk<\/code> package, the loop is identical, and the tool definitions use exactly the same fields. The webhook, queue and sending follow the pattern from the <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-bot-nodejs-express\/\">WhatsApp bot with Node.js<\/a>; the Python version without AI is in the <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-bot-python-fastapi\/\">bot with Python and FastAPI<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-bash\">npm install @anthropic-ai\/sdk<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-js\">import Anthropic from '@anthropic-ai\/sdk';\n\/\/ SYSTEM and TOOLS with the same content as the Python example (same JSON);\n\/\/ findOrder and notifyAgents live in your system\nimport { SYSTEM, TOOLS } from '.\/config.mjs';\nimport { findOrder, notifyAgents } from '.\/system.mjs';\n\nconst anthropic = new Anthropic(); \/\/ reads ANTHROPIC_API_KEY\nconst MODEL = process.env.CLAUDE_MODEL ?? 'claude-sonnet-5-5';\nconst MAX_ROUNDS = 5;\n\nasync function runTool(block, waId, conversation) {\n  if (block.name === 'get_order') {\n    const order = await findOrder(block.input.order_number, waId);\n    if (!order) return { content: 'Order not found for this customer.', failed: true };\n    return { content: JSON.stringify(order), failed: false };\n  }\n  if (block.name === 'transfer_to_human') {\n    conversation.state = 'human';\n    await notifyAgents(waId, block.input.reason);\n    return { content: 'Transferred. Tell the customer a person will take over.', failed: false };\n  }\n  return { content: `Unknown tool: ${block.name}`, failed: true };\n}\n\nexport async function askClaude(waId, conversation) {\n  const messages = [...conversation.history];\n  for (let round = 0; round &lt; MAX_ROUNDS; round++) {\n    const response = await anthropic.messages.create({\n      model: MODEL,\n      max_tokens: 16000,\n      system: SYSTEM,\n      tools: TOOLS,\n      output_config: { effort: 'low' },\n      messages,\n    });\n    if (response.stop_reason === 'tool_use') {\n      messages.push({ role: 'assistant', content: response.content });\n      const results = [];\n      for (const block of response.content) {\n        if (block.type !== 'tool_use') continue;\n        const { content, failed } = await runTool(block, waId, conversation);\n        results.push({ type: 'tool_result', tool_use_id: block.id, content, is_error: failed });\n      }\n      messages.push({ role: 'user', content: results });\n      continue;\n    }\n    if (response.stop_reason === 'end_turn') {\n      const text = response.content\n        .filter((b) =&gt; b.type === 'text')\n        .map((b) =&gt; b.text)\n        .join('')\n        .trim();\n      return text || null;\n    }\n    return null; \/\/ refusal, max_tokens: handoff\n  }\n  return null;\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">The 24-hour window: Claude replies, it doesn&#8217;t reach out<\/h2>\n\n\n\n<p><a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/messages\/send-messages\" target=\"_blank\" rel=\"noreferrer noopener\">Meta&#8217;s send messages documentation<\/a> says each customer message opens (or resets) a 24-hour customer service window. While it&#8217;s open, you can send text, media and interactive messages. Once it closes, only approved templates.<\/p>\n\n\n\n<p>In a Claude bot, that becomes three coding rules:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Check the window right before sending<\/strong>, not only when the message arrives. A slow tool loop, a stalled queue or a retry can cross the limit. The example compares <code>last_inbound<\/code> with the clock just before sending.<\/li>\n\n\n<li><strong>Generated text never goes out after the window.<\/strong> To re-engage (&#8220;your order has arrived&#8221;), use a template whose variables come from your system, not from the model.<\/li>\n\n\n<li><strong>The bot is reactive.<\/strong> Details in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-24-hour-customer-service-window\/\">the WhatsApp 24-hour customer service window<\/a>.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Tool safety<\/h2>\n\n\n\n<p>With tool use, Claude picks the tool and its arguments, but your code is what runs it. Three precautions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Identity comes from the webhook, not the model.<\/strong> The <code>wa_id<\/code> passed to <code>find_order<\/code> comes from the message&#8217;s <code>from<\/code> field. If the customer types someone else&#8217;s order number, the phone-filtered lookup returns nothing.<\/li>\n\n\n<li><strong>Reading is free; actions need confirmation.<\/strong> Cancelling an order, rescheduling or creating a charge needs an explicit &#8220;yes&#8221; from the customer or a person. See the guide to an <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-ai-agent-function-calling\/\">AI agent with tools<\/a>.<\/li>\n\n\n<li><strong>External content is data, not instructions.<\/strong> Anthropic recommends keeping content from external sources inside <code>tool_result<\/code> blocks, not in the <code>system<\/code> prompt.<\/li>\n\n<\/ul>\n\n\n\n<p>For the handoff itself, see <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-chatbot-human-handoff\/\">WhatsApp chatbot to human handoff<\/a>. If the conversation involves personal data of people in Brazil, the LGPD, Brazil&#8217;s data protection law (<a href=\"https:\/\/www.planalto.gov.br\/ccivil_03\/_ato2015-2018\/2018\/lei\/l13709.htm\" target=\"_blank\" rel=\"noreferrer noopener\">Law 13,709\/2018<\/a>), applies to what you send to the AI provider; this article is not legal advice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Meta allows<\/h2>\n\n\n\n<p>Since January 15, 2026, section 4.7 of 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> bars AI Providers from using the platform when general-purpose AI is the primary functionality of what they offer. Using Claude to serve your own business (orders, scheduling, support) is still allowed; a &#8220;chat with an AI about anything&#8221; service is a different case. The full rule and Brazil&#8217;s exception are covered in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-api-ai-policy-2026\/\">WhatsApp API AI policy in 2026<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How much it costs<\/h2>\n\n\n\n<p>There are two bills:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>WhatsApp.<\/strong> Replies inside the window are service messages. Since October 1, 2026, each number has an allowance of 1,000 service messages per month; from the 1,001st on, for recipients in Brazil, the rate is BRL 0.0350 per message, according to <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">Meta&#8217;s pricing page<\/a>. Templates are charged by category, inside or outside the window (marketing BRL 0.3217; utility and authentication BRL 0.0350).<\/li>\n\n\n<li><strong>Anthropic.<\/strong> Billed by input and output tokens, priced per model, on <a href=\"https:\/\/platform.claude.com\/docs\/en\/about-claude\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">Anthropic&#8217;s pricing page<\/a>. Tool definitions, the resent history and each <code>tool_result<\/code> round count as input.<\/li>\n\n<\/ul>\n\n\n\n<p>The per-conversation math, adding both parts, is in <a href=\"https:\/\/vectalk.com.br\/blog\/en\/whatsapp-ai-chatbot-cost-per-conversation\/\">how much an AI chatbot on WhatsApp costs per conversation<\/a>. What matters most: short history, one reply per question and the right model for each kind of question.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to do this with Vectalk<\/h2>\n\n\n\n<p>Vectalk is a proxy for the <a href=\"https:\/\/vectalk.com.br\/blog\/en\/official-whatsapp-api\/\">official WhatsApp API<\/a>: your bot receives webhooks in Meta&#8217;s format and sends with the same Cloud API JSON to <code>POST https:\/\/apis.vectalk.com.br\/api\/messages<\/code>, with <code>Authorization: Bearer &lt;token&gt;<\/code>. With an instance token, <code>phone_number_id<\/code> is resolved automatically; with an organization token, include <code>phone_number_id<\/code> in the body (<a href=\"https:\/\/docs.vectalk.com.br\/authentication\">authentication<\/a>). You register the bot URL with <code>POST https:\/\/apis.vectalk.com.br\/api\/webhooks<\/code>, passing <code>instance_id<\/code>, <code>url<\/code> and <code>name<\/code>.<\/p>\n\n\n\n<p>Vectalk has no built-in AI, support inbox or bulk messaging in its dashboard: Claude runs on your server, as in the example. If you code with an AI assistant, the documentation offers a search MCP server at <code>https:\/\/docs.vectalk.com.br\/mcp<\/code> so it can look up the routes instead of guessing. You don&#8217;t register a card with Meta: each delivered message is deducted from your account&#8217;s prepaid balance. Start at <a href=\"https:\/\/apps.vectalk.com.br\/register\">apps.vectalk.com.br\/register<\/a> and follow the <a href=\"https:\/\/docs.vectalk.com.br\/quickstart\">quickstart<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Which Claude model should I use on WhatsApp?<\/h3>\n\n\n\n<p>As of November 24, 2026, Anthropic describes Claude Sonnet 5.5 (<code>claude-sonnet-5-5<\/code>) as the best combination of speed and intelligence, and it&#8217;s the example&#8217;s default. Keep the ID in an environment variable and check the models page before going to production.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does Claude remember the conversation on its own?<\/h3>\n\n\n\n<p>No. The Messages API keeps no state: on every message you send that <code>wa_id<\/code>&#8216;s history, read from your database.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Do I need Meta&#8217;s permission to use Claude on WhatsApp?<\/h3>\n\n\n\n<p>For your own company&#8217;s customer service, you use the official API as usual. If your product is a general-purpose AI assistant, read section 4.7 of the terms before launching.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can Claude send the first message to a customer?<\/h3>\n\n\n\n<p>Not with generated text. Outside the 24-hour window, only an approved template, with variables coming from your system.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Official sources checked on November 24, 2026:<\/strong> <a href=\"https:\/\/platform.claude.com\/docs\/en\/models\/overview\" target=\"_blank\" rel=\"noreferrer noopener\">Anthropic: models overview<\/a>, <a href=\"https:\/\/platform.claude.com\/docs\/en\/build-with-claude\/working-with-messages\" target=\"_blank\" rel=\"noreferrer noopener\">Anthropic: Messages API<\/a>, <a href=\"https:\/\/platform.claude.com\/docs\/en\/agents-and-tools\/tool-use\/overview\" target=\"_blank\" rel=\"noreferrer noopener\">Anthropic: tool use<\/a>, <a href=\"https:\/\/platform.claude.com\/docs\/en\/agents-and-tools\/tool-use\/handle-tool-calls\" target=\"_blank\" rel=\"noreferrer noopener\">Anthropic: handle tool calls<\/a>, <a href=\"https:\/\/platform.claude.com\/docs\/en\/about-claude\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">Anthropic: pricing<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/messages\/send-messages\" target=\"_blank\" rel=\"noreferrer noopener\">Meta: send messages<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/typing-indicators\" target=\"_blank\" rel=\"noreferrer noopener\">Meta: typing indicators<\/a>, <a href=\"https:\/\/developers.facebook.com\/documentation\/business-messaging\/whatsapp\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">Meta: pricing<\/a>, <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>, <a href=\"https:\/\/docs.vectalk.com.br\/quickstart\">Vectalk: quickstart<\/a>, <a href=\"https:\/\/docs.vectalk.com.br\/authentication\">Vectalk: authentication<\/a>, <a href=\"https:\/\/docs.vectalk.com.br\/concepts\/webhooks\">Vectalk: webhooks<\/a>, <a href=\"https:\/\/www.planalto.gov.br\/ccivil_03\/_ato2015-2018\/2018\/lei\/l13709.htm\" target=\"_blank\" rel=\"noreferrer noopener\">Law 13,709\/2018 (LGPD)<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python and Node.js tutorial for answering WhatsApp customers with Claude: the Anthropic SDK, tool use, per-contact history and the 24-hour window.<\/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-2243","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>Claude on WhatsApp with the Official API | Vectalk<\/title>\n<meta name=\"description\" content=\"Claude WhatsApp bot: connect the Anthropic API to the official WhatsApp Business API with tool use, history per wa_id and the 24h window. Python and Node.\" \/>\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\/claude-whatsapp-business-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Claude on WhatsApp with the Official API | Vectalk\" \/>\n<meta property=\"og:description\" content=\"Claude WhatsApp bot: connect the Anthropic API to the official WhatsApp Business API with tool use, history per wa_id and the 24h window. Python and Node.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Vectalk\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-24T19:34:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-24T19:34:12+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=\"14 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\\\/claude-whatsapp-business-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/claude-whatsapp-business-api\\\/\"},\"author\":{\"name\":\"wanderleyfcunha\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/ff36ecd9d8257856f227f8e5d639db2b\"},\"headline\":\"Claude (Anthropic) + WhatsApp Business API: AI customer service\",\"datePublished\":\"2026-11-24T19:34:08+00:00\",\"dateModified\":\"2026-11-24T19:34:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/claude-whatsapp-business-api\\\/\"},\"wordCount\":1680,\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/claude-whatsapp-business-api\\\/\",\"url\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/claude-whatsapp-business-api\\\/\",\"name\":\"Claude on WhatsApp with the Official API | Vectalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#website\"},\"datePublished\":\"2026-11-24T19:34:08+00:00\",\"dateModified\":\"2026-11-24T19:34:12+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/ff36ecd9d8257856f227f8e5d639db2b\"},\"description\":\"Claude WhatsApp bot: connect the Anthropic API to the official WhatsApp Business API with tool use, history per wa_id and the 24h window. Python and Node.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/claude-whatsapp-business-api\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/claude-whatsapp-business-api\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/en\\\/claude-whatsapp-business-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vectalk.com.br\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Claude (Anthropic) + WhatsApp Business API: AI customer service\"}]},{\"@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":"Claude on WhatsApp with the Official API | Vectalk","description":"Claude WhatsApp bot: connect the Anthropic API to the official WhatsApp Business API with tool use, history per wa_id and the 24h window. Python and Node.","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\/claude-whatsapp-business-api\/","og_locale":"en_US","og_type":"article","og_title":"Claude on WhatsApp with the Official API | Vectalk","og_description":"Claude WhatsApp bot: connect the Anthropic API to the official WhatsApp Business API with tool use, history per wa_id and the 24h window. Python and Node.","og_url":"https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/","og_site_name":"Blog Vectalk","article_published_time":"2026-11-24T19:34:08+00:00","article_modified_time":"2026-11-24T19:34:12+00:00","author":"wanderleyfcunha","twitter_card":"summary_large_image","twitter_misc":{"Written by":"wanderleyfcunha","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/#article","isPartOf":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/"},"author":{"name":"wanderleyfcunha","@id":"https:\/\/vectalk.com.br\/blog\/#\/schema\/person\/ff36ecd9d8257856f227f8e5d639db2b"},"headline":"Claude (Anthropic) + WhatsApp Business API: AI customer service","datePublished":"2026-11-24T19:34:08+00:00","dateModified":"2026-11-24T19:34:12+00:00","mainEntityOfPage":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/"},"wordCount":1680,"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/","url":"https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/","name":"Claude on WhatsApp with the Official API | Vectalk","isPartOf":{"@id":"https:\/\/vectalk.com.br\/blog\/#website"},"datePublished":"2026-11-24T19:34:08+00:00","dateModified":"2026-11-24T19:34:12+00:00","author":{"@id":"https:\/\/vectalk.com.br\/blog\/#\/schema\/person\/ff36ecd9d8257856f227f8e5d639db2b"},"description":"Claude WhatsApp bot: connect the Anthropic API to the official WhatsApp Business API with tool use, history per wa_id and the 24h window. Python and Node.","breadcrumb":{"@id":"https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vectalk.com.br\/blog\/en\/claude-whatsapp-business-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vectalk.com.br\/blog\/"},{"@type":"ListItem","position":2,"name":"Claude (Anthropic) + WhatsApp Business API: AI customer service"}]},{"@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\/2243","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=2243"}],"version-history":[{"count":1,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts\/2243\/revisions"}],"predecessor-version":[{"id":2246,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/posts\/2243\/revisions\/2246"}],"wp:attachment":[{"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/media?parent=2243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/categories?post=2243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vectalk.com.br\/blog\/wp-json\/wp\/v2\/tags?post=2243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}