WhatsApp AI Bot 2026: Build Your Own With whatsapp-web.js (22k Stars) - No API Fees
The official WhatsApp Business API charges per conversation and requires business verification. But for personal use or small shops, open-source libraries can run an AI bot on your own number for free.
💡 What You Will Learn
The official WhatsApp Business API charges per conversation and requires business verification. But for personal use or small shops, open-source libraries can run an AI bot on your own number for free
📜 Table of Contents
The short answer
For personal and small-business bots, whatsapp-web.js (22,325 stars, Apache-2.0) is the most popular open-source WhatsApp client library: it connects through the WhatsApp Web session, so you can build an AI bot on your existing number without paying per-conversation fees. Baileys (10,558 stars, MIT) is the TypeScript alternative with better multi-device support.
What you can build
- Auto-reply FAQ bot powered by any LLM (OpenAI, Claude, or local Ollama).
- Order-taking assistant that reads a product catalog and answers stock/price questions.
- Personal assistant that summarizes forwarded links (feed URLs to an LLM).
- Broadcast tool for small shops - with strict compliance in mind.
Getting started (Node.js)
npm install whatsapp-web.js qrcode-terminal
const { Client, LocalAuth } = require('whatsapp-web.js');
const client = new Client({ authStrategy: new LocalAuth() });
client.on('qr', (qr) => console.log(qr)); // scan with your phone
client.on('message', async (msg) => {
const reply = await askLLM(msg.body); // your LLM call
msg.reply(reply);
});
client.initialize();
Key points: use LocalAuth so you do not re-scan the QR every restart; run it on a VPS or Raspberry Pi so the session stays alive; handle WhatsApp's rate limits with delays between messages.
Compliance warning
The WhatsApp Web protocol is not an official API. For anything beyond light personal use, WhatsApp can ban numbers that automate at scale. If you are running a business, the official Business Platform (Meta) or a BSP (Twilio, 360dialog) is the compliant path - expect ~$0.005-0.05 per conversation depending on country and template type.
FAQ
Is using whatsapp-web.js against WhatsApp ToS? It uses the web client protocol, which is not an official API; there is ban risk for high-volume automation. Keep volumes low for personal use.
Can it send media? Yes - images, documents, and audio via MessageMedia.
Does it work with multi-device? Baileys has better multi-device support; whatsapp-web.js works but with some limitations.
Related
❓ FAQ
Is using whatsapp-web.js against WhatsApp ToS?
It uses the web client protocol, which is not an official API; there is ban risk for high-volume automation. Keep volumes low for personal use.
Can it send media?
Yes - images, documents, and audio via MessageMedia.
Does it work with multi-device?
Baileys has better multi-device support; whatsapp-web.js works but with some limitations.
Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.
