Book a free call
Open source · WhatsApp API

WaSphere: a self-hosted, open-source WhatsApp API

Run your own WhatsApp API on your own server. WaSphere gives developers, hosting resellers and billing systems a REST API, a dashboard and signed webhooks, with no per-message fees and no managed service in the middle.

59 stars22 forks13 downloadsv1.3.0MITTypeScript
Overview

About WaSphere

WaSphere is a WhatsApp API platform you host yourself. Your WhatsApp sessions and contact data stay on your own infrastructure, so there is no vendor holding them and no fee per message. It is MIT licensed, so you can run it anywhere, fork it and ship it.

It is built for developers, hosting and WHMCS resellers, and billing systems that want a WhatsApp gateway they fully own. You connect one or many WhatsApp numbers, send messages through a REST API, receive incoming messages and status updates as signed webhooks, and manage everything from a web dashboard.

Features

What WaSphere includes

Multi-session

Run many WhatsApp numbers from one deployment, each with its own session, proxy and send settings.

14 message types

Text, image, video, audio and voice notes, documents, stickers, GIFs, view-once, buttons, lists, polls, reactions, locations and contact cards.

REST API

Every send type has its own endpoint. Authenticate with scoped API keys and call it from any language.

Signed webhooks

Incoming messages and status updates are posted to your URL, signed with HMAC-SHA256, with retries and automatic deactivation of failing hooks.

Web dashboard

A Next.js console for sessions, webhooks, API keys, messaging and the audit log, with dark mode.

Realtime inbox

A two-pane inbox with media, reactions, tags, notes, mute and a contacts list with CSV import and export. Live updates over server-sent events.

Poll vote tracking

Send a poll and receive the decrypted vote on a poll.vote webhook. Useful for order confirmation in Shopify or WooCommerce flows.

Scoped API keys

Twelve permission scopes, with optional per-session scoping. Keys are stored hashed and shown once.

Anti-ban controls

Configurable per-session send delays, auto-read and receipts, and sliding-window rate limiting.

Built-in API docs

An interactive API reference ships with both services, so every endpoint and schema is one click away.

Audit log

Every API request is logged and filterable, with 90-day retention.

One-command Docker

docker compose up -d starts the whole stack and runs database migrations automatically.

Screenshots

WaSphere in use

WaSphere dashboard for a self-hosted WhatsApp API with sessions, webhooks and inbox
DashboardThe WaSphere dashboard: sessions, webhooks, API keys, messaging and the inbox in one console.
Architecture

Three services, cleanly separated

WaSphere runs as three services. The WhatsApp engine is kept in its own service so the GPL-licensed library stays apart from your application layer.

ServiceWhat it doesBuilt with
WA ServerThe WhatsApp gateway: sessions, messages, contacts and groupsNestJS, TypeScript, Baileys
Dashboard APIAuth, workspaces, API keys, webhook delivery, audit log and a token-injecting proxy to the WA ServerNestJS, Prisma, PostgreSQL 16
Dashboard UIThe management console. It talks only to the Dashboard API, so the WA Server token never reaches the browserNext.js 16, Tailwind CSS, ShadCN UI
Security

Security built in

  • Sessions and contacts live only on your infrastructure.
  • Webhooks are signed with HMAC-SHA256 and a per-webhook secret. Outbound delivery is DNS-pinned and blocks private, loopback, link-local and cloud metadata addresses.
  • Stored WhatsApp server tokens are encrypted at rest with AES-256-GCM. Secrets are set through environment variables, never committed.
  • Passwords use Argon2id, login is timing-safe, and refresh tokens rotate with reuse detection. Registration locks after the first admin account.
API example

Send a message with curl

Requests go through the Dashboard API, which proxies to your WA Server. Authenticate with a scoped key.

curl -X POST https://api.your-domain.com/workspaces/{workspaceId}/proxy/api/sessions/{sessionId}/messages/text \
  -H "Authorization: Bearer wsk_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "to": "12125550100", "text": "Hello from WaSphere!" }'
Install

How to install WaSphere

  1. Install Docker Engine 24 or later with Docker Compose v2. For a public deployment, put your own reverse proxy in front for TLS.
  2. Clone the repository, copy .env.example to .env and set the secrets in it. Generate each one with openssl rand -hex 32.
  3. Run docker compose up -d. Open http://localhost:3004 and register the first account, which becomes the admin.
  4. In Settings, WA Server, set the URL to http://wa-server:3001 and your WA_TOKEN. Then connect a number under Sessions.
git clone https://github.com/wasphere/wasphere.git
cd wasphere
cp .env.example .env
# set POSTGRES_PASSWORD, JWT_SECRET, ENCRYPTION_KEY, WA_TOKEN,
# WEBHOOK_SIGNING_SECRET and INTERNAL_WEBHOOK_SECRET
docker compose up -d
Details
Requirements
Docker Engine 24+ and Docker Compose v2
Database
PostgreSQL 16
Stack
NestJS, Prisma, Next.js 16, Baileys, pnpm workspaces
Price
Free. No per-message fees.
FAQ

WaSphere: questions answered

More questions? Ask on WhatsApp

Is WaSphere free?

Yes. It is open source under the MIT license. You pay only for your own server. There are no per-message fees.

What do I need to run it?

A server with Docker Engine 24 or later and Docker Compose v2. The whole stack starts with one docker compose command. For a public deployment, add your own reverse proxy for TLS.

Does it use the official WhatsApp Business API?

The WhatsApp gateway is built on Baileys, an open-source library that connects the way WhatsApp Web does. It is not a hosted service from Meta, so follow the WhatsApp terms and use sensible send delays. WaSphere includes per-session delays and auto-read settings for that reason. It also lists a template endpoint for Meta Cloud API sessions.

How do I send a message?

Call the REST API with a scoped API key. For example, POST to the text message endpoint with the recipient number and the text. The page above has a curl example, and a full interactive API reference ships with the app.

Can I use it with WHMCS, n8n or Shopify?

WaSphere has no plugin for them, but it works with anything that can call a REST API or receive a webhook. Incoming messages and poll votes are posted to your URL as signed webhooks. The project README shows an n8n webhook as an example.

Can Wasevo set it up or build on top of it?

Yes. We can deploy and secure WaSphere on your server and build WhatsApp automations around it. See AI and WhatsApp automation and custom software.

Want a module or integration built for you?

A free 15-minute call, then a written scope and estimate. No obligation, no sales script.