Skip to content

fentinak/OpenWA

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

194 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

OpenWA Logo

OpenWA

Open Source WhatsApp API Gateway

Features β€’ Quick Start β€’ Docs β€’ API β€’ Contributing

CI Version License Node NestJS Docker TypeScript


✨ Why OpenWA?

OpenWA is a free, open-source WhatsApp API Gateway designed for developers who need full control over their messaging infrastructureβ€”without vendor lock-in or hidden paywalls.

Built on a pluggable architecture, OpenWA lets you swap database engines (SQLite/PostgreSQL), storage backends (Local/S3), and cache layers (Memory/Redis) without changing a single line of application code.

πŸ”“ 100% Open Source No licensing fees, no feature locks, full source code access
πŸ—οΈ Pluggable Architecture Swap adapters for database, storage, and cache via config
πŸ–₯️ Full Dashboard Modern React UI for session, webhook, and API key management
πŸ”Ή Multi-Session Ready Run multiple WhatsApp sessions concurrently on one instance
🐳 Docker Native Production-ready with zero configuration
πŸ”— n8n Integration Community nodes for workflow automation
🧩 Community Adapters Third-party integrations (e.g. ioBroker) β€” see docs

🎯 Features

Core Features

Feature Status Description
REST API βœ… Full WhatsApp API via HTTP endpoints
Multi-Session βœ… Manage multiple WhatsApp accounts
Webhooks βœ… Real-time events with HMAC signature
Web Dashboard βœ… Visual management interface
API Key Auth βœ… Secure API authentication
Swagger Docs βœ… Interactive API documentation

Messaging

Feature Status Description
Text Messages βœ… Send/receive text messages
Media Messages βœ… Images, videos, documents, audio
Message Reactions βœ… React to messages with emoji
Bulk Messaging βœ… Send to multiple recipients
Message Status βœ… Track delivery and read receipts

Advanced

Feature Status Description
Groups API βœ… Create, manage, and message groups
Channels/Newsletter βœ… WhatsApp Channels support
Labels Management βœ… Organize chats with labels
Proxy Support βœ… Per-session proxy configuration
Rate Limiting βœ… Configurable request limits
CIDR Whitelisting βœ… IP-based access control
Audit Logging βœ… Track all API operations

Infrastructure

Feature Status Description
SQLite βœ… Zero-config embedded database
PostgreSQL βœ… Production-grade database
Redis Cache βœ… Optional performance caching
S3/MinIO Storage βœ… Scalable media storage
Docker βœ… One-command deployment
Health Checks βœ… Kubernetes-ready probes
Data Migration βœ… Export/import between backends

πŸš€ Quick Start

Option A: Docker (Recommended)

# Clone and start
git clone https://github.com/rmyndharis/OpenWA.git
cd OpenWA
docker compose -f docker-compose.dev.yml up -d

# Access
# Dashboard: http://localhost:2886
# API: http://localhost:2785/api
# Swagger: http://localhost:2785/api/docs

Using Podman instead of Docker? Podman rootless mode requires the socket to be running and DOCKER_HOST to be set:

systemctl --user start podman.socket
systemctl --user enable podman.socket
export DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock

Add the export line to your ~/.bashrc to make it permanent.

Option B: Local Development

# Clone repository
git clone https://github.com/rmyndharis/OpenWA.git
cd OpenWA

# Install dependencies (includes dashboard)
npm install

# Start API + Dashboard (config is auto-generated on first run)
npm run dev

# Access
# Dashboard: http://localhost:2886
# API: http://localhost:2785/api
# Swagger: http://localhost:2785/api/docs

πŸ”’ Security Architecture

Docker Socket Proxy

The production stack never exposes /var/run/docker.sock directly to the application container. Instead, a dedicated docker-proxy sidecar (based on tecnativa/docker-socket-proxy) acts as the sole gateway to the Docker daemon:

openwa-api  ──TCP 2375──▢  docker-proxy  ──unix──▢  /var/run/docker.sock

Only the operations needed for container orchestration are enabled (CONTAINERS, IMAGES, VOLUMES, INFO, PING, POST, DELETE). The application connects via the DOCKER_HOST=tcp://docker-proxy:2375 environment variable, which DockerService detects automatically.


πŸ”’ Security Architecture

Non-root Container Execution

The production image never runs the Node.js process as root. On startup, the container follows this chain:

dumb-init (PID 1)
  └─ docker-entrypoint.sh (root β€” fixes named-volume ownership via chown)
       └─ gosu openwa node dist/main  (drops to the openwa user)
  • dumb-init is PID 1 and forwards signals (SIGTERM, etc.) for graceful shutdown.
  • docker-entrypoint.sh runs as root only long enough to chown the named-volume mount points so the openwa user can write to them.
  • gosu performs a clean exec-based privilege drop β€” no su or sudo wrappers, so the node process is the direct child of dumb-init.

Named volumes (e.g. openwa-data) get their ownership corrected automatically on every start, so no manual chown step is needed after volume creation.


🏭 Production Deployment

For production, use the main docker-compose.yml with optional services:

# Basic production (SQLite, local storage)
docker compose up -d

# With PostgreSQL database
docker compose --profile postgres up -d

# Full stack (PostgreSQL, Redis, Dashboard, Traefik)
docker compose --profile full up -d
Profile Services
postgres PostgreSQL database
redis Redis cache
minio S3-compatible storage
with-dashboard Web dashboard
with-proxy Traefik reverse proxy
full All services above

Development vs Production

  • Development (docker-compose.dev.yml): SQLite, local storage, both API & Dashboard included
  • Production (docker-compose.yml): Configurable database, profiles for optional services

Official GHCR images are published as multi-arch manifests for:

  • linux/amd64
  • linux/arm64

πŸ”Œ Ports

Service Port Description
API 2785 REST API endpoints
Dashboard 2886 Web management interface
Swagger 2785/api/docs Interactive API docs

πŸ“‘ API Examples

Create a Session

curl -X POST http://localhost:2785/api/sessions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{"name": "my-bot"}'

Start Session & Get QR Code

# Start the session
curl -X POST http://localhost:2785/api/sessions/{sessionId}/start \
  -H "X-API-Key: YOUR_API_KEY"

# Get QR code (scan with WhatsApp)
curl http://localhost:2785/api/sessions/{sessionId}/qr \
  -H "X-API-Key: YOUR_API_KEY"

Send a Message

curl -X POST http://localhost:2785/api/sessions/{sessionId}/messages/send-text \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "chatId": "628123456789@c.us",
    "text": "Hello from OpenWA!"
  }'

Setup Webhook

curl -X POST http://localhost:2785/api/sessions/{sessionId}/webhooks \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "url": "https://your-server.com/webhook",
    "events": ["message.received", "session.status"],
    "secret": "your-hmac-secret"
  }'

πŸ›  Tech Stack

Layer Technology
Runtime Node.js 22 LTS
Framework NestJS 11.x
Language TypeScript 5.x
WA Engine whatsapp-web.js
Database SQLite / PostgreSQL
Cache Redis (optional)
Storage Local / S3 / MinIO
ORM TypeORM
Container Docker + Docker Compose

πŸ“ Project Structure

openwa/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.ts                 # Application entry point
β”‚   β”œβ”€β”€ app.module.ts           # Root module
β”‚   β”œβ”€β”€ config/                 # Configuration
β”‚   β”œβ”€β”€ common/                 # Shared utilities
β”‚   β”‚   β”œβ”€β”€ cache/              # Redis caching
β”‚   β”‚   └── storage/            # File storage (Local/S3)
β”‚   β”œβ”€β”€ core/                   # Core systems
β”‚   β”‚   β”œβ”€β”€ hooks/              # Plugin hooks
β”‚   β”‚   └── plugins/            # Plugin system
β”‚   β”œβ”€β”€ engine/                 # WhatsApp engine abstraction
β”‚   └── modules/
β”‚       β”œβ”€β”€ session/            # Session management
β”‚       β”œβ”€β”€ message/            # Message handling
β”‚       β”œβ”€β”€ webhook/            # Webhook management
β”‚       β”œβ”€β”€ group/              # Groups API
β”‚       β”œβ”€β”€ contact/            # Contacts API
β”‚       β”œβ”€β”€ auth/               # API key authentication
β”‚       β”œβ”€β”€ infra/              # Infrastructure management
β”‚       └── health/             # Health checks
β”œβ”€β”€ dashboard/                  # React web dashboard
β”œβ”€β”€ docs/                      # Documentation
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ Dockerfile
└── package.json

πŸ“š Documentation

Comprehensive documentation is available in the docs/ folder:

Document Description
Project Overview Introduction and goals
Requirements Feature specifications
Architecture System design
Security Security implementation
Database Data models and migrations
API Spec Complete API reference
Development Coding standards
Migration Guide Database & storage migration

🀝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please read our Development Guidelines for coding standards and best practices.


πŸ“„ License

This project is licensed under the MIT License – free for personal and commercial use.

See LICENSE for details.


OpenWA – Free, Open Source WhatsApp API Gateway

πŸ“– Documentation Β· πŸ”Œ API Docs Β· πŸ› Report Bug Β· πŸ’‘ Request Feature


Made with ❀️ by Yudhi Armyndharis and the OpenWA Community

About

Free, Open Source, Self-Hosted WhatsApp API Gateway

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 87.3%
  • CSS 10.3%
  • Shell 1.3%
  • JavaScript 0.5%
  • Python 0.3%
  • Dockerfile 0.3%