ezdevv/wa-gateway

By ezdevv

•Updated 6 months ago

High-performance WhatsApp Gateway API with Queue support (Redis + BullMQ) built on Baileys.

Image
Integration & delivery
Message queues
API management
0

1.3K

ezdevv/wa-gateway repository overview

ā šŸš€ WA Gateway API (High Security Edition)

A robust, queue-based WhatsApp Gateway API built with Node.js, Express, Baileys, and BullMQ (Redis). Designed for high concurrency, reliability, and secure authentication using Argon2.

⁠✨ Features

  • Advanced Scheduler: Supports delayed messages using scheduleAt (ISO 8601 format).
  • Queue System: Uses BullMQ & Redis to handle high traffic without banning risks.
  • Secure Auth: Implements Argon2 Hashing for API Keys (Industry standard security).
  • REST API: Simple HTTP endpoints to send messages.
  • Lightweight: Built on Alpine Linux Node.js image.
  • Persistent Session: WhatsApp session is saved in a volume (no need to rescan QR on restart).

ā šŸ› ļø Tech Stack

  • Core: Node.js & TypeScript
  • WA Library: @whiskeysockets/baileys
  • Queue: BullMQ & Redis
  • Security: Argon2 (Password Hashing)

ā šŸš€ Quick Start

⁠1. Generate Your Security Hash

Since this image uses secure hashing, you cannot just put "my-password" in the config. You need to generate an Argon2 hash of your desired API Key.

Run this command locally to get your hash string:

npx argon2-cli "your-super-secret-password"
# Output example: $argon2id$v=19$m=65536,t=3,p=4$KBk...

⁠2. Create Configuration Files

Create a .env file and a docker-compose.yml file in your directory.

⁠Step A: Create .env file

āš ļø CRITICAL: You MUST escape the $ signs in your hash by doubling them ($$) when putting them in the .env file for Docker Compose.

  • Original Hash: $argon2id$v=19...
  • In .env File: $$argon2id$$v=19...
NODE_ENV=production
PORT=3001

# CORS Configuration
ALLOWED_ORIGIN=*

# YOUR HASHED PASSWORD (Remember to use $$ instead of $)
API_SECRET_HASH=$$argon2id$$v=19$$m=65536,t=3,p=4$$i2grMA559rFdFwWWFanIRg$$dG+80Hw+VDhxHBXYnPAoWDFsa4zTgcxWs7CWdFI717o

# Redis Config
REDIS_HOST=redis-queue
REDIS_PORT=6379
REDIS_PASSWORD=password_redis_rahasia
⁠Step B: Create docker-compose.yml
version: "3.8"

services:
  # Service 1: WA Gateway Application
  wa-gateway:
    image: ezdevv/wa-gateway:latest
    container_name: wa-gateway-app
    restart: unless-stopped
    ports:
      - "${PORT}:${PORT}"
    env_file:
      - .env
    environment:
      - PORT=${PORT}
      - REDIS_HOST=${REDIS_HOST}
      - REDIS_PORT=${REDIS_PORT}
      - REDIS_PASSWORD=${REDIS_PASSWORD}
      - API_SECRET_HASH=${API_SECRET_HASH}
    volumes:
      - ./auth_info_baileys:/app/auth_info_baileys
    depends_on:
      - redis-queue

  # Service 2: Redis
  redis-queue:
    image: redis:alpine
    container_name: redis-wa-queue
    restart: always
    command: redis-server --requirepass ${REDIS_PASSWORD} --maxmemory-policy noeviction
    volumes:
      - redis_data:/data
    ports:
      - "${REDIS_PORT}:${REDIS_PORT}"

volumes:
  redis_data:

⁠3. Run the Service

Start the containers:

docker-compose up -d

⁠4. Scan QR Code

View the logs to see the QR Code and scan it with your WhatsApp:

docker logs -f wa-gateway-app

ā šŸ”Œ API Usage

Send Message Endpoint

  • URL: POST http://localhost:3001/send
  • Header: x-api-key -> Enter your Plain Text Password (NOT the hash).
⁠Example Request:
curl --location 'http://localhost:3001/send' \
--header 'Content-Type: application/json' \
--header 'x-api-key: your-super-secret-password' \
--data '{
    "number": "6281234567890",
    "message": "Hello from Docker!",
    "scheduleAt": "2026-01-29T08:44:24.527Z"
}'

Disclaimer: This project is not affiliated with WhatsApp. Use responsibly.

Tag summary

Content type

Image

Digest

sha256:1d5b435c6…

Size

90.9 MB

Last updated

6 months ago

docker pull ezdevv/wa-gateway