The OpenClaw Gateway is the core runtime of the OpenClaw framework -- a self-hosted, open-source platform for building AI agents that communicate across chat platforms. The Gateway is the single process that powers every OpenClaw deployment, handling message routing, agent execution, session management, and channel integration in one unified service.
Unlike cloud-based agent platforms that lock you into a vendor's infrastructure, the OpenClaw Gateway runs entirely on your own hardware. You install it on a VPS, a Kubernetes cluster, a Raspberry Pi, or bare metal. Your data never leaves your servers, making it ideal for teams with strict privacy requirements, GDPR compliance needs, or simply a preference for full control over their AI stack.
The Gateway connects to 20+ chat platforms -- WhatsApp, Telegram, Discord, Slack, iMessage, Microsoft Teams, and more -- through a plugin-based channel adapter system. Each adapter normalizes incoming messages into a platform-agnostic format, so your agent code works identically regardless of where the user is chatting from. This means you write your agent logic once, and it automatically works across every connected channel.
At its heart, the Gateway is a message router. When a user sends a message on any connected platform, the Gateway receives it, evaluates the routing rules (called bindings), dispatches it to the appropriate AI agent, waits for the agent's response, and sends it back to the user on the originating platform. The entire pipeline -- from message receipt to response delivery -- typically completes in under 2 seconds.
Configuration is straightforward: a single JSON file at ~/.openclaw/openclaw.json defines everything -- the gateway port, channel connections, agent configurations, model providers, and routing rules. Secrets are handled via ${VAR_NAME} environment variable syntax, so credentials never need to be hardcoded.
Master openclaw gateway architecture
Take the OpenClaw Configuration & Binding course with hands-on lessons and challenges.
The install script downloads the OpenClaw CLI. The onboard command runs an interactive wizard that configures authentication, gateway settings, and optional channels. The gateway command starts the process, which begins listening for messages from all configured channels. The default port is 18789.
This is a complete, working configuration. The gateway listens on port 18789, connects to Telegram and Discord via bot tokens stored in environment variables, and routes all messages to a default agent using Claude Sonnet. Tokens are never hardcoded -- the ${VAR_NAME} syntax references environment variables at runtime.
Regardless of which platform a message originates from, the agent receives this normalized structure. The channel field identifies the source, but the agent logic remains platform-agnostic. This abstraction is what allows one agent to serve multiple chat platforms without any platform-specific code.
For production deployments, wrap the Gateway in a process manager like pm2 so it restarts automatically on crashes and persists across system reboots. Running openclaw gateway directly in a terminal means it stops when the terminal closes -- pm2 prevents this.
This shows the complete lifecycle of a message through the Gateway. Each step is handled by a different internal component (adapter, router, agent runtime), but they all run within the same process. The routing engine is the decision point that determines which agent handles each message.
Assuming OpenClaw is a hosted SaaS service and looking for a signup page or dashboard URL
OpenClaw is self-hosted. You install it on your own machine or server and run the Gateway process yourself. There is no cloud-hosted version. This is by design for data ownership and privacy.
Running the Gateway on Node.js versions below 22, causing cryptic startup errors
OpenClaw requires Node.js 22+. Always check your version with `node --version` before starting the Gateway. Use nvm or fnm to manage Node.js versions if needed.
Starting the Gateway directly in a terminal for production use, losing the process when the terminal closes
Use a process manager like pm2, systemd, or Docker for production deployments. These ensure the Gateway restarts on crashes and persists across system reboots.
Hardcoding bot tokens and API keys directly in openclaw.json instead of using environment variables
Always use the ${VAR_NAME} syntax in your configuration file to reference environment variables. Never commit tokens to version control. Use a secrets manager or .env file for local development.
Forgetting to open firewall ports for webhook-based channels like Telegram, causing messages to never reach the Gateway
Channels that use webhooks need your server to be reachable on the configured port. Ensure your firewall, cloud security group, or reverse proxy allows inbound traffic on the Gateway port (default 18789).
The OpenClaw Gateway is a single Node.js 22+ process that acts as the runtime for the OpenClaw AI agent framework. It routes messages between chat platforms (WhatsApp, Telegram, Discord, Slack, and 20+ others) and the AI agents you configure. It handles channel adapters, message normalization, routing, agent execution, and session storage -- all in one self-hosted process.
No. The OpenClaw Gateway is fully self-hosted. There is no SaaS version or cloud subscription. You install and run it on your own infrastructure -- a VPS, Kubernetes, Docker, or bare metal. This gives you complete data ownership and privacy compliance.
The OpenClaw Gateway requires Node.js 22 or higher. This is a hard requirement because the Gateway uses modern Node.js features like native fetch, structuredClone, and import assertions that are unavailable in older versions.
Yes. A single Gateway instance can connect to multiple chat platforms at the same time. Each platform uses a channel adapter that normalizes messages into a standard format, so your agents receive the same message structure regardless of the source platform.
For production deployments, run the Gateway behind a reverse proxy (Nginx or Caddy) for TLS termination and use a process manager like pm2, systemd, or Docker to ensure automatic restarts. Never expose the raw Gateway port to the public internet. Store your configuration in version control and use environment variables for secrets.
The OpenClaw Gateway is a single Node.js 22+ process that routes messages between chat platforms and AI agents. It handles channel adapters, message normalization, routing, agent runtime, and session storage -- all in one process. Configuration lives in a single JSON file with environment variable support for secrets. For production, always use a process manager and reverse proxy. The Gateway's platform-agnostic message format means your agent code works identically across WhatsApp, Telegram, Discord, and 20+ other platforms.
Interactive lessons and challenges on Stanza, practice in VS Code, Cursor, or the web.
Interactive lessons and challenges, right in your code editor.
Check the free courses. No credit card.