Tutorials
Build a Free WhatsApp Bot in Node.js with OpenWA
Automate WhatsApp with pure Node.js — no Twilio, no Business API, no per-message fees. Full setup with QR login, message handlers, media, and a template repo.

7-minute read · Updated September 2026
The WhatsApp Business API costs money per conversation and takes weeks to approve. For 90% of side-project use cases — a reminder bot, a broadcast tool for your community, a customer-service auto-reply — you don't need it. You need OpenWA, the open-source Node.js library that drives WhatsApp Web through Puppeteer and lets you script every button, message, and media call as if you were the browser.
I've been running an OpenWA bot for 8 months to broadcast blog updates to a group of ~120 readers. Zero downtime, zero cost, zero API-key drama. This is the exact setup.
Why OpenWA over the Business API
- Free. No conversation fees, no approval, no Meta review.
- Fast to prototype. QR scan in 30 seconds, first automated message in 5 minutes.
- Full feature parity with WhatsApp Web — buttons, lists, stickers, voice notes, groups.
- Trade-off: it uses your personal number and violates ToS in the strict sense. Use it on a burner number for anything non-personal. For anything commercial-at-scale, migrate to the official API.
Install and First Boot
create({ sessionId: "MAIN" }).then(client = { client.onMessage(async message = { if (message.body === 'ping') { await client.sendText(message.from, 'pong 🏓'); } }); });
Run node index.js, scan the QR code in the terminal, message the number ping from another phone — you get pong back. That's it.
Broadcast to a Group
Get the group ID with client.getAllGroups(). I hardcode it in .env once and never touch it again.
Send an Image with a Caption
Deploy for Free (24×7)
Two options I've tried:
1. Fly.io free tier — one small VM, persistent volume for the session cache. Costs ~$0/month if you stay in the shared-cpu-1x band. 2. Raspberry Pi — my current setup. Node 20, PM2, done. Uses less power than a lightbulb.
Both need --no-sandbox for headless Chromium:
Templates I Recommend
- The wa-automate-nodejs README — canonical docs.
- My template repo (soon): auto-reconnect, structured logging, message queue with Trigger.dev for retries.
When to Not Use OpenWA
If you're building for a client, going through a marketplace, or expecting more than ~1000 messages/day per number — you need the official API. OpenWA is a builder tool, not a compliance tool. Use it accordingly.
Bottom Line
OpenWA is the fastest way to prove a WhatsApp automation idea. Ship the prototype in an evening, decide whether the ROI justifies the Business API later.
Grabbing this for a project? Ping me on Twitter/X — I'll share the deploy config.