npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

baileys-rest

v0.1.0

Published

Lightweight MIT REST API for WhatsApp via Baileys. The free Evolution API alternative.

Downloads

32

Readme

baileys-rest

npm version License: MIT

Lightweight MIT REST API for WhatsApp via Baileys. The free Evolution API alternative.

Why This Exists

Evolution API has 8k+ stars but is GPL-3 licensed, heavy, opinionated, and runs as a full app/Docker stack. Many developers want a lightweight MIT alternative they can npm install and embed into their own Node.js application, or run as a standalone server.

baileys-rest fills this gap:

  • MIT licensed - Use commercially without restrictions
  • Lightweight - Single dependency on @whiskeysockets/baileys
  • Flexible - Run standalone or embed in your app
  • Composable - Integrates seamlessly with baileys-antiban and baileys-webhooks

Installation

npm install baileys-rest @whiskeysockets/baileys

Quick Start

Standalone Server (CLI)

npx baileys-rest --port 3000 --auth-dir ./auth --api-key supersecret

This starts an Express server on port 3000. On first run, scan the QR code or use pairing code to authenticate.

Embedded Mode

import { createBaileysRest } from 'baileys-rest';

const server = await createBaileysRest({
  authDir: './auth',
  apiKey: process.env.WA_API_KEY!,
  withAntiban: true,         // Optional: wraps socket via baileys-antiban
  antibanPreset: 'moderate',
  port: 3000
});

await server.listen();

API Reference

All endpoints require X-API-Key header matching your configured API key.

Auth & Status

| Endpoint | Method | Description | Auth Required | |----------|--------|-------------|---------------| | /health | GET | Server health and connection status | No | | /auth/qr | GET | Get QR code for pairing (returns 204 if already connected) | Yes | | /auth/status | GET | Check connection status and JID | Yes | | /auth/pair | POST | Generate pairing code for phone number | Yes | | /auth/logout | POST | Logout and clear session | Yes |

Messages

| Endpoint | Method | Description | |----------|--------|-------------| | /messages/text | POST | Send text message | | /messages/image | POST | Send image with optional caption | | /messages/document | POST | Send document | | /messages/:jid | GET | Get recent messages (cached, last 100 per JID) |

Groups

| Endpoint | Method | Description | |----------|--------|-------------| | /groups | GET | List all groups | | /groups/:id | GET | Get group metadata | | /groups/:id/messages | POST | Send message to group |

Webhooks

| Endpoint | Method | Description | |----------|--------|-------------| | /webhooks | POST | Register webhook | | /webhooks | GET | List webhooks | | /webhooks/:id | DELETE | Remove webhook |

Examples

Send Text Message

curl -X POST http://localhost:3000/messages/text \
  -H "X-API-Key: supersecret" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "27821234567",
    "text": "Hello from baileys-rest!"
  }'

Send Image

curl -X POST http://localhost:3000/messages/image \
  -H "X-API-Key: supersecret" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "27821234567",
    "imageUrl": "https://example.com/image.jpg",
    "caption": "Check this out!"
  }'

Get Pairing Code

curl -X POST http://localhost:3000/auth/pair \
  -H "X-API-Key: supersecret" \
  -H "Content-Type: application/json" \
  -d '{"phoneNumber": "27821234567"}'

Composability

With baileys-antiban

Add rate limiting, warmup, and health monitoring:

import { createBaileysRest } from 'baileys-rest';

const server = await createBaileysRest({
  authDir: './auth',
  apiKey: 'supersecret',
  withAntiban: true,         // Automatically wraps socket
  antibanPreset: 'moderate'
});

First install: npm install baileys-antiban

With baileys-webhooks

Coming in v0.2 - full webhook event delivery system.

CLI Options

baileys-rest [options]

Options:
  --port <number>          Port to listen on (default: 3000)
  --auth-dir <path>        Directory for auth session (default: ./auth)
  --api-key <key>          API key for authentication (required)
  --with-antiban           Enable baileys-antiban if installed
  --antiban-preset <p>     Preset: conservative|moderate|aggressive (default: moderate)
  --cors-origin <origin>   CORS origin (default: *)
  --help                   Show this help message
  --version                Show version

Deployment

Docker Compose

version: '3.8'

services:
  baileys-rest:
    image: node:20-alpine
    working_dir: /app
    command: npx baileys-rest --port 3000 --auth-dir /data --api-key ${WA_API_KEY}
    ports:
      - "3000:3000"
    volumes:
      - ./auth:/data
    environment:
      - WA_API_KEY=${WA_API_KEY}
    restart: unless-stopped

Roadmap (v0.2)

  • Media upload from disk/URL/base64
  • Story/status posting
  • Contact info retrieval
  • Presence broadcast
  • Full webhook event delivery system via baileys-webhooks
  • Message editing/deletion
  • Reaction support
  • Poll creation

License

MIT - See LICENSE file for details.

Author

Kobus Wentzel [email protected]

Related Projects

Contributing

Contributions welcome! Please open an issue or PR on GitHub.

Support

  • GitHub Issues: https://github.com/kobie3717/baileys-rest/issues
  • NPM: https://www.npmjs.com/package/baileys-rest