Baileys
Socket-based TS/JavaScript API for WhatsApp Web
A TypeScript library for Node.js that lets you send and receive WhatsApp messages from code without running a browser, connects directly to WhatsApp's servers over WebSocket.
Baileys is a TypeScript and JavaScript library that lets developers build programs which interact with WhatsApp through the WhatsApp Web interface. Rather than automating a web browser, Baileys communicates directly with WhatsApp's servers over a WebSocket connection. This means it does not need a running browser in the background and uses significantly less memory as a result. The library supports both the multi-device and web versions of WhatsApp.
Using Baileys, a developer can write code that sends and receives messages, handles media like images, video, audio, and GIFs, manages group chats, reads and updates profile information, tracks typing indicators and presence, handles polls and reactions, and archives or deletes conversations. Connections can be established by scanning a QR code or using a pairing code, and session credentials can be saved so the account stays connected across restarts.
The library is installed via npm or Yarn and imported into a Node.js, Deno, or Bun project. A working example script is included in the repository that demonstrates many common operations. Full documentation lives on a separate website at baileys.wiki, and community support takes place through a Discord server.
Baileys is not affiliated with or endorsed by WhatsApp. The maintainers explicitly discourage using it for spam, bulk messaging, automated outreach, or stalkerware, and ask users to apply personal responsibility in how they use the library. Enterprise-level support from the current maintainer is available for hire, and businesses are encouraged to sponsor the project given the substantial ongoing development effort. The original repository was removed by its initial author, and this repository is the current community-maintained continuation.
The full README is longer than what was shown.
Where it fits
- Build a WhatsApp chatbot that responds automatically to incoming messages using Node.js.
- Send WhatsApp messages, images, or voice notes programmatically from a server-side script.
- Manage WhatsApp group chats: add members, update group info, and track message reactions from code.
- Save and restore a WhatsApp session so your bot stays connected across server restarts without re-scanning a QR code.