Gateway

Connect superclaw to Slack, Discord, Telegram, and WhatsApp.

What it is

superclaw-gateway is a standalone HTTP server that receives webhook events from chat platforms, runs them through the superclaw agent runtime (imported as a Go library — no separate process), and sends results back to the channel.

It is a separate project from superclaw, designed to stay thin. The gateway handles authentication, message routing, and async dispatch. superclaw handles the actual work.

Architecture

text
Slack ─────┐
Discord ───┤──► POST /webhook/{channel}
Telegram ──┤         │
WhatsApp ──┘         ▼
                verify signature
                     │
                     ▼
                parse message
                     │
                     ▼
             worker pool (goroutines)
                     │
                     ▼
             superclaw.Run(task)
                     │
                     ▼
              channel.Send(reply)

Request lifecycle

  1. 1Webhook arrives at POST /webhook/{channel}
  2. 2Signature verified (HMAC for Slack/WhatsApp, Ed25519 for Discord, secret header for Telegram)
  3. 3Message parsed and normalized to a common format
  4. 4HTTP 200 returned immediately — the client is never kept waiting
  5. 5Worker goroutine calls superclaw.Run() with the message text as the task
  6. 6Reply sent back to the originating channel and conversation

Async dispatch

Worker pool processes tasks in the background. Webhook caller gets 200 immediately — no hanging connections.

Per-user rate limiting

Max concurrent tasks and max per time window per user. Configurable. Prevents any single user from monopolizing workers.

Channel isolation

Each channel verifies its own signature independently. A misconfigured channel cannot affect others.