<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jahid</title>
    <description>The latest articles on DEV Community by Jahid (@jahid_f2e1d0f0947034ab697).</description>
    <link>https://dev.to/jahid_f2e1d0f0947034ab697</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4246118%2Ff12d129e-346d-467b-a5c8-18c6fa55329c.jpg</url>
      <title>DEV Community: Jahid</title>
      <link>https://dev.to/jahid_f2e1d0f0947034ab697</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jahid_f2e1d0f0947034ab697"/>
    <language>en</language>
    <item>
      <title>How a WhatsApp AI Agent Works on a Regular Number (No Business API)</title>
      <dc:creator>Jahid</dc:creator>
      <pubDate>Sun, 15 Nov 2026 15:03:41 +0000</pubDate>
      <link>https://dev.to/jahid_f2e1d0f0947034ab697/how-a-whatsapp-ai-agent-works-on-a-regular-number-no-business-api-121k</link>
      <guid>https://dev.to/jahid_f2e1d0f0947034ab697/how-a-whatsapp-ai-agent-works-on-a-regular-number-no-business-api-121k</guid>
      <description>&lt;p&gt;Most "WhatsApp chatbot" tutorials start with the official WhatsApp Business API: a Meta developer app, a verified business, webhook setup and per-conversation fees. That is the right choice for large companies. But a lot of small businesses (a bakery, a clinic, a phone shop) just want an assistant on the number their customers already have.&lt;/p&gt;

&lt;p&gt;I've been working on &lt;a href="https://wapzen.io" rel="noopener noreferrer"&gt;Wapzen&lt;/a&gt;, a WhatsApp AI agent that runs on an existing number. Here is how that kind of system fits together, and the problems you hit that tutorials don't mention.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Connecting: the linked-device protocol
&lt;/h2&gt;

&lt;p&gt;WhatsApp lets a phone link up to four extra devices (that's how WhatsApp Web works). Open-source libraries such as &lt;a href="https://github.com/WhiskeySockets/Baileys" rel="noopener noreferrer"&gt;Baileys&lt;/a&gt; speak that protocol, so a server can act as one more linked device.&lt;/p&gt;

&lt;p&gt;Two ways to link:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;QR code&lt;/strong&gt;: the server shows a QR, the user scans it under &lt;em&gt;Linked devices&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pairing code&lt;/strong&gt;: the user types their number and enters an 8-character code on the phone. We found this works much better for people who only have one phone and can't scan their own screen.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Things that bit us:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Session keys must be saved atomically.&lt;/strong&gt; If the process dies between writing two key files, the session breaks and the user has to scan again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The WhatsApp Web version matters.&lt;/strong&gt; Connect with an outdated version and the server rejects you with a 405 before any QR appears. Fetch the current version at runtime instead of hard-coding it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deploys need a handover plan.&lt;/strong&gt; During a rolling deploy two instances can try to own the same session. One of them gets kicked, so only one instance may hold a session at a time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not official.&lt;/strong&gt; This approach isn't an official Meta product and businesses should know that. The Business API is the official route.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Answering: an agent, not a decision tree
&lt;/h2&gt;

&lt;p&gt;Each incoming message goes to an LLM with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a system prompt the business owner writes (what they sell, prices, hours, tone)&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;knowledge base&lt;/strong&gt;: the owner's documents chunked and embedded in a vector index, searched at reply time&lt;/li&gt;
&lt;li&gt;the &lt;strong&gt;recent conversation&lt;/strong&gt;: the last ~20 exchanges word for word, with older history folded into a rolling summary so long chats don't blow up the context&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Customers also send voice notes and photos, so those get transcribed or described before the model sees them. In many markets voice notes are half the traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Tools: where the real value is
&lt;/h2&gt;

&lt;p&gt;Answering questions is nice. Doing things is better. The agent gets tools such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;create_order&lt;/code&gt;: with a forced confirmation step. The model has to read the full order back and get a "yes" before the tool will save it. If the customer then says "make it 3, not 2", the open order is amended instead of a duplicate being created.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;send_file&lt;/code&gt;: sends the owner's product photos or PDFs when the request matches the file's description.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;read_website&lt;/code&gt;: reads pages on the business's own site (same domain only, to keep it from fetching arbitrary URLs).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Guardrails you will need on day one
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Loop guard.&lt;/strong&gt; Two bots replying to each other will happily chat forever. Detect echoes and floods per contact and switch the AI off for that chat.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per-contact off switch.&lt;/strong&gt; Owners want to handle some customers personally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Groups off by default&lt;/strong&gt;, and only reply when tagged or replied to.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignore Status updates.&lt;/strong&gt; WhatsApp Status posts arrive like messages, and replying to them (or acknowledging them wrongly) causes trouble.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;If you want to see the result without building it yourself, &lt;a href="https://wapzen.io" rel="noopener noreferrer"&gt;Wapzen&lt;/a&gt; is free to start: link a number, describe your business, and the agent starts replying. There's also a write-up on &lt;a href="https://wapzen.io/whatsapp-business-api-alternative" rel="noopener noreferrer"&gt;using it as a WhatsApp Business API alternative&lt;/a&gt;, including when you should still use the official API.&lt;/p&gt;

&lt;p&gt;Happy to answer questions about the linked-device side in the comments.&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>ai</category>
      <category>chatbot</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
