HUB
Sign inSign up
relay logo

softagon/relay

By softagon

•Updated 21 minutes ago

Self-hosted WhatsApp API gateway & MCP Server in Rust with 10-language Console, SQLite & Whisper.

Image
0

822

softagon/relay repository overview

⁠Softagon Relay — Self-Hosted WhatsApp API Gateway & Local MCP Server in Rust

Softagon Relay (softagon/relay) is an open-source, self-hosted WhatsApp Web HTTP API gateway, 10-language embedded Web Console, and native MCP Server built in Rust by Softagon Sistemas⁠. It runs as a single ~55 MB Docker container with embedded SQLite (WAL), optional S3-compatible media storage (AWS S3, Cloudflare R2, MinIO), HMAC-SHA256 signed webhooks with persistent outbox retries, OpenAPI 3.2.1 (/openapi.json, /openapi.yaml, /docs), and offline multilingual voice-note transcription powered by whisper.cpp.


⁠Quick Start (One-Line Docker Run)

KEY="$(openssl rand -hex 32)" && echo "RELAY_API_KEY=$KEY" && docker run -d --name softagon-relay --restart unless-stopped -p 127.0.0.1:8080:8080 -v relay-data:/data -e RELAY_API_KEY="$KEY" softagon/relay:latest

Binds to 127.0.0.1:8080 and generates a random 256-bit key. Known placeholder keys and keys shorter than 16 characters are rejected at startup.

Open http://localhost:8080/console and sign in with the printed RELAY_API_KEY, or check health:

curl http://localhost:8080/v1/health

⁠Measured Container Footprint (Real Scenarios)

Measurements recorded on 2026-11-25 against softagon/relay:0.3.0 (linux/amd64, compiled with --features whisper) using docker stats --no-stream on Docker 29.1.3 / Linux (x86_64):

ScenarioMeasured ValueNotes
Image Size (linux/amd64)~55 MB compressed (Docker Hub)Rust binary, Vue 3 Console, SQLite, S3 client, Opus decoder, rmcp, and whisper.cpp
Boot / Idle (0 paired sessions)~4–5 MiB RAMRight after startup, before pairing any WhatsApp session
1 Paired WhatsApp Session (steady state)~38 MiB RAM · ~0.1–0.2% CPU1 real WhatsApp account connected via WebSocket
During Whisper base Transcription~212–338 MiB RAMModel loads lazily on incoming voice note and unloads after 180s idle (~100 MiB RSS after unload)
External Databases Required0Embedded SQLite (WAL); S3/R2/MinIO is optional

services:
  relay:
    image: softagon/relay:0.3.5
    container_name: softagon-relay
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:8080"
    volumes:
      - relay-data:/data
    environment:
      RELAY_API_KEY: "${RELAY_API_KEY:?Generate with: openssl rand -hex 32}"
      RUST_LOG: "info"
      DOCS_ENABLED: "true"
      DOCS_PUBLIC: "false"
      MEDIA_STORAGE: "local"
      TRANSCRIPTION_ENABLED: "true"
      TRANSCRIPTION_MODEL: "base"
      TRANSCRIPTION_LANGUAGE: "auto"
      TRANSCRIPTION_PRELOAD: "false"
      TRANSCRIPTION_IDLE_UNLOAD_SECONDS: "180"
    read_only: true
    tmpfs:
      - /tmp:size=128m,noexec,nosuid
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL

volumes:
  relay-data:

Permissions note: The container runs as non-root user relay (UID 10001). Named Docker volumes work automatically. If you use a host bind mount, make sure UID 10001 has write permissions on /data.


⁠Supported Tags

TagArchitectureDescription
latestlinux/amd64Latest stable release (0.3.5)
0.3linux/amd64Latest 0.3.x release
0.3.5linux/amd6410-language Web Console & docs (PT, EN, ES, FR, ID, Betawi, Sundanese, Javanese, Batak Toba, Malay), dropdown switcher, dynamic version, automated i18n/docs checks
0.3.4linux/amd64Docker MCP HTTP container-bind opt-in, unexpanded placeholder rejection, safe STDIO snippets

Multi-arch note: Prebuilt images currently target linux/amd64. linux/arm64 builds are on our roadmap.


⁠REST API (/v1) & Native MCP Server

All /v1/* routes except GET /v1/health require Authorization: Bearer <RELAY_API_KEY>:

MethodEndpointPurpose
GET/v1/healthPublic liveness & readiness probe
GET / POST/v1/sessionsList or create WhatsApp sessions
GET / DELETE/v1/sessions/{session_id}Get metadata or delete disconnected session (409 if connected)
GET/v1/sessions/{session_id}/qr · /qr.svgGet pairing QR code (JSON or SVG)
GET/v1/sessions/{session_id}/statusGet live connection state
POST/v1/sessions/{session_id}/reconnectRestart and start a fresh QR cycle
POST/v1/sessions/{session_id}/logoutDisconnect and unlink device
POST/v1/sessions/{session_id}/messages/textSend text message (supports Idempotency-Key & BR/MX/AR mobile resolution)
POST/v1/sessions/{session_id}/messages/mediaSend image, video, audio, or document
GET/v1/messages/{message_id}Retrieve message status & metadata
GET / POST/v1/messages/{message_id}/transcriptionFetch or retry voice-note transcription
GET / POST/v1/webhooksList or create webhook subscriptions
GET / PATCH / DELETE/v1/webhooks/{webhook_id}Inspect, update, or remove a webhook
GET/docs · /openapi.json · /openapi.yamlScalar API Reference & OpenAPI 3.2.1 spec (JSON/YAML)
⁠Local MCP Server (v0.3.0)
  • STDIO (default local mode): softagon-relay mcp --stdio (logs routed to stderr)
  • Streamable HTTP: softagon-relay mcp --http or MCP_HTTP_ENABLED=true (binds to 127.0.0.1:8091/mcp by default; in Docker behind -p 127.0.0.1:8091:8091, opt in with MCP_HTTP_HOST=0.0.0.0 + MCP_ALLOW_CONTAINER_BIND=true; always enforces loopback Host/Origin validation, Bearer auth, destructive tools blocked by default, and SQLite audit in mcp_audit_log).

⁠Environment Variables

VariableDefaultDescription
RELAY_API_KEY(required)Bearer API key. Startup fails if empty, shorter than 16 characters, a known placeholder, or an unexpanded ${…}/<…> template. Generate with openssl rand -hex 32.
APP_HOST / APP_PORT0.0.0.0 / 8080Bind host and port
RUST_LOGinfoStructured JSON log level (error, warn, info, debug)
DATA_DIR/dataPersistent volume root
DOCS_ENABLED / DOCS_PUBLICtrue / falseControls /docs, /openapi.json, and /openapi.yaml availability & auth
MEDIA_MAX_UPLOAD_BYTES26214400Max upload size (25 MiB)
SESSION_RATE_LIMIT_PER_MINUTE60Per-session outbound message rate limit
SQLITE_JOURNAL_MODE / SQLITE_BUSY_TIMEOUT_MSwal / 5000SQLite WAL & lock timeout (use local disk, not NFS)
MEDIA_STORAGElocallocal (/data/media) or s3 (AWS S3, Cloudflare R2, MinIO)
S3_ENDPOINT_URL, S3_REGION, S3_BUCKET, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_PREFIXauto, softagon-relay/S3-compatible object storage settings (used when MEDIA_STORAGE=s3)
TRANSCRIPTION_ENABLED / TRANSCRIPTION_MODEL / TRANSCRIPTION_LANGUAGEtrue / base / autoOffline Whisper transcription settings (tiny, base, small, medium, large)
TRANSCRIPTION_PRELOAD / TRANSCRIPTION_IDLE_UNLOAD_SECONDSfalse / 180Lazy-load on first audio and unload after idle timeout
WEBHOOK_DELIVERY_TIMEOUT_SECONDS / WEBHOOK_MAX_ATTEMPTS / WEBHOOK_BACKOFF_BASE_SECONDS10 / 8 / 2Webhook HTTP timeout and retry backoff policy
MCP_HTTP_ENABLED / MCP_HTTP_HOST / MCP_HTTP_PORTfalse / 127.0.0.1 / 8091Enable local MCP Streamable HTTP server (/mcp, loopback-only by default)
MCP_ALLOW_CONTAINER_BIND / MCP_ALLOW_DESTRUCTIVE / MCP_ALLOWED_ORIGINSfalse / false / (loopback)Opt in to 0.0.0.0 bind inside Docker behind -p 127.0.0.1:8091:8091, destructive tools, and extra Origins

⁠Frequently Asked Questions (FAQ)

  • Why Rust instead of Chromium / Puppeteer / Node.js? Softagon Relay talks directly to WhatsApp Web over WebSocket (whatsapp-rust), keeping steady-state usage at ~38 MiB RAM and ~55 MB compressed Docker image size with zero external databases (PostgreSQL/Redis/RabbitMQ) or FFmpeg.
  • Which languages are supported? The embedded /console UI and visual docs support 10 languages: Português (pt-BR), English (en), Español (es), Français (fr), Bahasa Indonesia (id), Basa Betawi (bew — Jakarta & Bekasi), Basa Sunda (su — Bandung & Bekasi), Basa Jawa (jv — Surabaya), Hata Batak Toba (bbc — Medan), and Bahasa Melayu (ms — Medan).
  • Can I connect AI agents (Claude Desktop, Cursor, Antigravity) or n8n? Yes — use the built-in MCP Server (mcp --stdio or Streamable HTTP /mcp) for local AI agents, and the /v1 HTTP API + /openapi.json + HMAC-SHA256 signed webhooks for n8n and custom apps.

⁠Transparency, Roadmap & Disclaimer

  • AI-assisted development: Softagon Relay is developed with AI-assisted coding under human architecture, review, security design, and live testing against real WhatsApp accounts.
  • Roadmap: Native Tauri Desktop app (Windows, Linux, macOS) + linux/arm64 Docker images. Want these sooner? Open an issue on GitHub: https://github.com/SoftagonSistemas/whatsapp-gateway-relay-softagon/issues/new⁠
  • Unofficial project: Softagon Relay is an independent open-source project built on whatsapp-rust and is not affiliated with, authorized by, or endorsed by Meta or WhatsApp. Always deploy behind TLS and protect backups of /data.

Tag summary

Content type

Image

Digest

sha256:e537450d8…

Size

52.5 MB

Last updated

21 minutes ago

docker pull softagon/relay