Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Waaza

Self-hosted WhatsApp REST API with Web Dashboard, Role-Based Access, and Async Message Queue

Go PostgreSQL Docker License: MIT

Features · Quick Start · API Reference · Deployment · Architecture


Overview

Waaza is a production-ready WhatsApp REST API built with Go, powered by the whatsmeow library. It provides a complete backend for sending and receiving WhatsApp messages programmatically, with a built-in web dashboard for session management.

Designed for teams and businesses that need a reliable, self-hosted WhatsApp gateway without vendor lock-in.

Features

  • Multi-Instance Management — Run multiple WhatsApp sessions from a single server
  • Role-Based Access Control — Admin and User roles with scoped permissions
  • Async Message Queue — Durable outbox backed by PostgreSQL with exponential backoff retry
  • Web Dashboard — Manage instances, scan QR codes, and monitor message status
  • OpenAPI Specification — Full Swagger UI with documented endpoints
  • Session Control — Connect, disconnect, logout, and QR pairing via Linked Devices
  • Webhook Support — Configure callbacks for incoming messages
  • Docker & Systemd Ready — Deploy anywhere with included configs
  • CI/CD Pipeline — Automated Docker builds and release tagging via GitHub Actions

Quick Start

Prerequisites

  • Go 1.25+
  • PostgreSQL 14+
  • Git

Run Locally

git clone https://github.com/guna64/waaza.git
cd waaza

# Set environment variables
export PORT=8090
export WAAZA_PROVIDER=whatsmeow
export WAAZA_DB_DRIVER=pgx
export WAAZA_DB_DSN='postgres://waaza:password@127.0.0.1:5432/waaza?sslmode=disable'
export WAAZA_API_KEY='your-user-token'
export WAAZA_ADMIN_TOKEN='your-admin-token'

go run ./cmd/server

Run with Docker

docker build -t waaza .
docker run -p 8090:8090 \
  -e WAAZA_DB_DSN='postgres://waaza:pass@host:5432/waaza?sslmode=disable' \
  -e WAAZA_API_KEY='your-user-token' \
  -e WAAZA_ADMIN_TOKEN='your-admin-token' \
  waaza

Access

Endpoint Description
http://localhost:8090/dashboard Web Dashboard
http://localhost:8090/api/ Swagger UI
http://localhost:8090/api/spec.yml OpenAPI Spec
http://localhost:8090/health Health Check

API Reference

Authentication

All API endpoints require an API key via the Authorization header.

Public Endpoints

Method Endpoint Description
GET /health Health check
POST /auth/verify Verify API key
GET /api/ Swagger UI
GET /api/spec.yml OpenAPI specification

User Endpoints

Method Endpoint Description
GET /instances/me List user instances
GET /instances/me/:id Get instance details
POST /instances/me/:id/session/connect Connect instance
GET /instances/me/:id/session/qr Get QR code for pairing
POST /instances/me/:id/chat/send/text Send text message (async)

Admin Endpoints

Method Endpoint Description
GET /admin/instances List all instances
POST /admin/instances Create instance
GET /admin/instances/:id Get instance details
DELETE /admin/instances/:id Delete instance
POST /admin/instances/:id/session/connect Connect instance
POST /admin/instances/:id/chat/send/text Send text message

Queue Endpoints

Method Endpoint Description
GET /queue/:id Check message queue status

Queue Status Flow: pendingprocessingsent | faileddead

Deployment

Systemd

sudo cp deploy/waaza.service /etc/systemd/system/
sudo mkdir -p /etc/waaza
sudo cp deploy/waaza.env.example /etc/waaza/waaza.env
sudo chmod 600 /etc/waaza/waaza.env

sudo systemctl daemon-reload
sudo systemctl enable --now waaza
sudo systemctl status waaza

Environment Variables

Variable Description Example
PORT HTTP server port 8090
WAAZA_PROVIDER WhatsApp provider whatsmeow
WAAZA_DB_DRIVER Database driver pgx
WAAZA_DB_DSN PostgreSQL connection string postgres://user:pass@host:5432/db
WAAZA_API_KEY User API key your-user-token
WAAZA_ADMIN_TOKEN Admin authentication token your-admin-token

Architecture

waaza/
├── cmd/server/          # Application entrypoint
├── internal/
│   ├── api/             # HTTP handlers & routing
│   ├── config/          # Configuration management
│   ├── middleware/       # Auth middleware (API key)
│   ├── service/         # Business logic & outbox worker
│   ├── store/           # PostgreSQL persistence layer
│   └── wa/              # WhatsApp adapter (whatsmeow)
├── web/templates/       # Dashboard HTML templates
├── openapi/             # API specification
└── deploy/              # Systemd service & env template

Key Design Decisions:

  • Hexagonal architecture — Clean separation between domain logic and adapters
  • Outbox pattern — Reliable async message delivery with PostgreSQL-backed queue
  • Port-based abstractions — WhatsApp adapter is swappable (mock adapter included for testing)

Security

  • Store credentials in /etc/waaza/waaza.env with 600 permissions
  • Rotate WAAZA_ADMIN_TOKEN, WAAZA_API_KEY, and database passwords regularly
  • Restrict network access (e.g., Tailscale/VPN only)
  • Review logs before exposing publicly

Roadmap

  • Contacts & groups management via whatsmeow
  • Queue list/retry/cancel endpoints
  • Token hashing & auth hardening
  • Trusted proxies & security headers
  • CI test pipeline

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

Self-hosted WhatsApp REST API with web dashboard, role-based access control, and async message queue. Built with Go and whatsmeow.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages