Skip to content

RESTFull HTTP API + Command handler for Baileys-based WhatsApp

Notifications You must be signed in to change notification settings

decryptable/wa-bot

Repository files navigation

WA Bot

Important

This project is currently under development. Production use isn't recommended unless you know what you're doing!

Todo Features Development

  • RESTFull API implementation
    • send video message
    • send audio message
    • send text message
    • manage session from HTTP API, except logout
    • Other API features are in development
  • WhatsApp socket side command handler implementation. For command handlers, check the code structure in the ./commands folder
  • RESTFull API documentation using OpenAPI
  • API code reference documentation

Requirements

Quick Setup

  1. Clone this repository

    git clone https://github.com/decryptable/wa-bot
    
    cd wa-bot
  2. Install required dependencies

    bun i # or bun install
  3. Setup environment variables

    cp .env.example .env

    Leave the default if you are lazy to read the code structure.

  4. Start server

    bun start
    # example outputs
    Version: 1.0.0
    Author: Decryptable
    Description: Simple whatsapp bot
    Environment: development
    Node Version: v22.3.0
    4/17/2025, 6:47:22 AM INFO: Killed another proccess on port 3000!
    4/17/2025, 6:47:22 AM INFO: Initializing session: decryptable
    4/17/2025, 6:47:22 AM INFO: All sessions initialized successfully. Total: 1
    
    # ...

    This command will run the RESTFull API and command handler. Supports multi-sessions.

Project Structures

wa-bot
├── .env.example
├── .env.local
├── .gitignore
├── bun.lockb
├── bunfig.toml
├── package.json
├── preload.ts
├── README.md
├── server.ts
├── tsconfig.json
├── commands/
│   ├── ... command handlers
├── lib/
│   ├── logger.ts
│   ├── matchRoute.ts
│   ├── routesLoader.ts
│   ├── sessions.ts
│   ├── socket.ts
│   └── utils.ts
├── public/
│   └── banner.jpg
└── routes/
    ├── index.ts
    └── api/
        ├── sessions.ts
        ├── status.ts
        └── [sessionId]/
            ├── getContacts.ts
            ├── init.ts
            ├── logout.ts
            ├── qr.ts
            ├── sendAudioMessage.ts
            ├── sendVideoMessage.ts
            ├── sendTextMessage.ts
            └── status.ts