WABotJS is a TypeScript library for building WhatsApp bots on top of Baileys, the leading open-source WhatsApp Web client. Where Baileys gives you a powerful but low-level WebSocket interface, WABotJS layers a clean, ergonomic API on top — handling authentication, SQLite-backed session persistence, command routing, and common message actions so you can focus on your bot’s logic rather than the plumbing.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jzszdznzzl/WABotJS/llms.txt
Use this file to discover all available pages before exploring further.
Key Features
QR & OTP Authentication
Connect your bot by scanning a QR code in the terminal, or pair silently using a phone number OTP — no manual browser session required.
Automatic Session Persistence
Sessions are stored in SQLite via Node.js’s built-in
node:sqlite module (available since v24). No native bindings or third-party drivers needed.Built-in Command Routing
Incoming messages that start with your configured prefix are automatically parsed into a command name and argument list, delivered to your
onCommand handler.Message Action Helpers
Reply to, react on, mark as read, delete, and edit messages through simple async methods on the
Message object — no raw Baileys calls required.Media Downloading
Download image, video, audio, document, and sticker messages as a
Buffer with a single message.download() call.JID ↔ Phone-Number Cache
A SQLite-backed store automatically maps between WhatsApp LID JIDs and E.164 phone numbers so you can look up either direction without extra API calls.
Message Cache with TTL
Received messages are stored with a configurable time-to-live so Baileys can retrieve them during retry and decryption flows automatically.
Group Metadata Cache
Group metadata is cached in memory with a 10-minute TTL, reducing redundant fetches during high-traffic periods.
Automatic Reconnection
On unexpected disconnects the bot reconnects with exponential back-off (starting at 5 s, capped at 5 min), giving transient network issues time to recover.
Typed Baileys Re-export
The full Baileys library is re-exported as
baileys from the WABotJS package entry point, so you can import Baileys types without a separate dependency.What is Baileys?
Baileys is a reverse-engineered Node.js client for WhatsApp Web that communicates directly over the WhatsApp WebSocket protocol. It gives you full programmatic access to messaging, groups, media, and presence — but its API is intentionally close to the wire. WABotJS wraps Baileys with a higher-level, object-oriented API that handles the repetitive setup (auth state, event wiring, caching) and surfaces only what most bot authors need day to day.Requirements
| Requirement | Details |
|---|---|
| Node.js | v24 or later — required for the built-in node:sqlite module |
| Project type | ESM ("type": "module" in package.json) |
| TypeScript | v5+ recommended — types are shipped with the package |
Package Exports
WABotJS exposes the following named exports fromwabotjs. Every export is available as both a named import and via the default object:
| Export | Description |
|---|---|
Bot | The primary class for creating and managing a WhatsApp bot instance. |
Auth | Handles loading, saving, and dropping authentication credentials to disk. |
Utils | A collection of helper functions (type guards, error coercion, TTLCache, LRU cache, delays, and more). |
Socket | A thin wrapper around the Baileys WebSocket client with WABotJS defaults applied. |
Message | Represents an incoming WhatsApp message with action helpers (reply, edit, react, download, etc.). |
Stores | Namespace containing the SQLite-backed JID and Message store classes used for caching. |
baileys | The full Baileys 7.0.0-rc13 library re-exported, so you can use Baileys types and helpers without a separate dependency. |
Constants | Internal constants used by WABotJS (e.g. USER_AGENT string). |
Quick Links
Quickstart
Get a working bot running in minutes with a step-by-step walkthrough.
Installation
Detailed setup instructions for all package managers and TypeScript configuration.
Authentication Guide
Learn how to use QR-code and phone-number OTP pairing modes.
Bot API Reference
Full reference for the
Bot class, its handlers, and all available methods.