01

Why we use Baileys instead of the official WhatsApp Business API

WhatsAppInfrastructureAutomation

When we built the AI booking bot for Tepe Watersports, the first real technical decision was which WhatsApp API to build on. Meta offers an official Business API. It's documented, it's supported, and it's the answer most people reach for. We chose not to use it. Here's why — and what we learned running the alternative in production for over a year.

What the official API actually costs you

The Meta Business API charges per conversation, not per message. Rates range from $0.05 to $0.15 per conversation depending on country and type. For a business handling 200 conversations a month in peak season, that's $10–30/month before you've built anything.

That sounds manageable. The real cost isn't the money.

Template approval is the slower tax. Every message your bot sends proactively — a confirmation, a follow-up, a price quote — requires a pre-approved template. You write it, submit it to Meta, wait 24–72 hours, and then you can send it. If Meta rejects it, you start over. If your use case changes week-to-week as a seasonal business, you're permanently behind.

Human takeover is structurally blocked in the API's conversation threading model. Once a bot session is open, there's no clean way to hand off mid-thread to a human agent who can see the full context and continue from where the bot stopped. You can build workarounds, but they're hacks at the protocol level.

What Baileys is

Baileys is an open-source Node.js library that connects to WhatsApp by implementing the WhatsApp Web protocol — the same one your browser uses when you open web.whatsapp.com. No official support, no Meta approval, no per-conversation fee.

What you get in exchange: full control. No template restrictions — the bot can say anything, in any format, immediately. No approval queues — deploy a change and it's live in seconds. Full message history in your own data store. And human takeover that actually works: an agent opens the panel, sees the entire conversation, and picks up exactly where the bot stopped, with no visible disruption to the customer.

The tepews.com bot handles TR, EN, RU, and AR. It negotiates pricing, runs a full reservation flow including KVKK compliance, sends date confirmation messages, notifies admins, and supports a one-click human takeover panel. None of that is possible on the official API without significant architectural compromise.

The real tradeoff

Baileys runs on an unofficial protocol. WhatsApp could change something that breaks it. The number you're using is technically operating against the platform's terms of service.

In practice: the library is maintained, widely used in production, and has been stable for years. The tepews bot has been running without interruption since early 2024, handling peak-season traffic in Bodrum.

The calculus we use: if this is a mission-critical channel where any interruption would be catastrophic and you have the budget for the official API's constraints, build on the official API. If speed, flexibility, and cost matter more than the theoretical risk of a protocol change — which in practice gives you weeks of notice before it becomes a real problem — Baileys is the right call.

For a watersports business in peak season where the bot needs to respond to pricing questions at 2am and staff needs to jump in on complex negotiations, the cost of inflexibility was immediate and real. The risk of Baileys breaking was slow-moving and manageable.

What the architecture looks like

The full stack: Node.js with Baileys for the WhatsApp connection, Claude API (Sonnet for pricing and negotiation logic, Haiku for language classification and routing), a WordPress plugin that syncs live price lists to the bot, Redis via Upstash for session state, GitHub for persistent conversation backup, and Render for hosting.

Total infrastructure cost per month at current scale: approximately $0 beyond the Claude API usage. The Claude API spend runs around $5–15/month depending on conversation volume.

The WordPress plugin is the piece that makes the pricing reliable — prices update once in the WP admin, and the bot queries the plugin's REST endpoint before quoting. Nothing is hardcoded in the bot. Nothing can become stale.

The bot runs, the takeover panel works, and the pricing is always current. The official API would have cost more, shipped slower, and been less useful.

Work with us →← Back to insights