DEV Community

Cover image for How to Build a Multi-Channel AI Assistant with OpenClaw (2026 Guide)
Preecha
Preecha

Posted on

How to Build a Multi-Channel AI Assistant with OpenClaw (2026 Guide)

TL;DR

OpenClaw is a self-hosted gateway that connects WhatsApp, Telegram, Discord, and iMessage to AI coding agents. You run one Gateway process on your machine, and it becomes the bridge between your messaging apps and an AI assistant you control. There are no cloud dependencies or required data-sharing services—you choose the AI provider and control where messages are routed.

Try Apidog today

Why Multi-Channel AI Matters

You might be on WhatsApp when a client asks about an API endpoint, switch to Telegram to check with your team, and then receive a bug report in Discord. Each platform has separate context and conversation history, so you end up switching between multiple AI assistants.

OpenClaw addresses this fragmentation by connecting multiple messaging platforms to one self-hosted AI assistant. You control the data, choose the AI model, and define how messages are routed.

If you test APIs across different platforms or coordinate with teams on multiple channels, Apidog can help manage API workflows while OpenClaw handles AI routing.

This guide covers how to:

  • Install OpenClaw
  • Connect WhatsApp, Telegram, Discord, and iMessage
  • Configure multiple AI agents
  • Route messages by channel, sender, keyword, or custom logic
  • Monitor and troubleshoot the Gateway

What Is OpenClaw?

OpenClaw is an open-source gateway between messaging applications and AI agents. Think of it as a universal translator for AI conversations.

Image

Its main characteristics are:

  • Self-hosted: Run it on your own hardware.
  • Multi-channel: Connect WhatsApp, Telegram, Discord, iMessage, and other platforms to one Gateway process.
  • Agent-native: Use sessions, memory, tools, and multi-agent routing.
  • Open source: OpenClaw is MIT licensed, so you can fork, modify, and contribute to it.

The Gateway runs as a Node.js process. It maintains connections to your messaging platforms and routes messages to AI providers such as Anthropic, OpenAI, or local models. Each conversation can have its own isolated session and memory.

Request flow

The basic flow looks like this:

  1. You send a message on WhatsApp.
  2. OpenClaw receives the message through the WhatsApp channel.
  3. The Gateway routes it to a configured AI agent.
  4. The agent processes the request and generates a response.
  5. OpenClaw sends the response back to WhatsApp.

The same flow applies to Telegram, Discord, iMessage, and other connected channels. The Gateway handles authentication, session management, and message formatting.

Key capabilities

Multi-channel gateway

Connect WhatsApp, Telegram, Discord, and iMessage through one Gateway process. Channels run independently, so an issue with one channel does not necessarily stop the others.

Plugin channels

Add Mattermost and other platforms through extension packages. You can also write custom channel adapters without modifying the core code.

Multi-agent routing

Route messages to different AI agents based on the sender, channel, keyword, or custom logic. For example, use one agent for code questions, another for documentation, and a third for general chat.

Media support

Send and receive images, audio, and documents. The Gateway handles file uploads, downloads, and format conversions.

Web Control UI

Use the browser dashboard to view chats, configuration, sessions, nodes, and routing decisions.

Mobile nodes

Pair iOS and Android devices for Canvas, camera and screen capture, and voice-enabled workflows.

Set Up Your First Gateway

You need:

  • Node.js 22 or later
  • An API key from an AI provider
  • About five minutes

The examples below use Anthropic's Claude, but the same setup pattern applies to other providers.

1. Install OpenClaw

Install the package globally:

npm install -g openclaw@latest
Enter fullscreen mode Exit fullscreen mode

This adds the openclaw command to your PATH.

2. Run the onboarding wizard

Start the setup wizard:

openclaw onboard --install-daemon
Enter fullscreen mode Exit fullscreen mode

The wizard prompts you for:

  • AI provider: Anthropic, OpenAI, or a custom endpoint
  • API key: Stored locally in ~/.openclaw/config.json
  • Default model: For example, claude-sonnet-4-6
  • Daemon setup: Whether OpenClaw should run as a background service

The --install-daemon option configures OpenClaw to start when the system boots. Omit it if you want to start the Gateway manually.

3. Connect WhatsApp

Run the channel login command:

openclaw channels login
Enter fullscreen mode Exit fullscreen mode

A QR code appears in the terminal. Scan it with WhatsApp on your phone, similar to connecting WhatsApp Web.

Verify the connection:

openclaw channels list
Enter fullscreen mode Exit fullscreen mode

Expected output:

Active channels:
- whatsapp (connected)
Enter fullscreen mode Exit fullscreen mode

4. Start the Gateway

Launch the Gateway on port 18789:

openclaw gateway --port 18789
Enter fullscreen mode Exit fullscreen mode

You should see output similar to:

OpenClaw Gateway v1.0.0
Listening on http://localhost:18789
Channels: whatsapp (connected)
Agents: default (claude-sonnet-4-6)
Enter fullscreen mode Exit fullscreen mode

Open http://localhost:18789 in your browser to access the Control UI. It displays active channels, connected agents, and recent messages.

5. Send a test message

Send a message to your WhatsApp number from another device. For example:

Explain async/await in JavaScript.
Enter fullscreen mode Exit fullscreen mode

The Gateway receives the message, sends it to Claude, and returns the response to WhatsApp.

Use the Control UI to inspect the conversation, raw message data, and routing decisions.

Connect Multiple Channels

Once WhatsApp is working, you can add Telegram, Discord, and iMessage.

Add Telegram

Create a Telegram bot:

  1. Open Telegram and search for @BotFather.
  2. Send /newbot.
  3. Follow the prompts.
  4. Copy the bot token.

Add the bot to OpenClaw:

openclaw channels add telegram --token YOUR_BOT_TOKEN
Enter fullscreen mode Exit fullscreen mode

Start a conversation with the bot on Telegram and send a test message. By default, it uses the same AI agent as WhatsApp.

Add Discord

Create a Discord bot:

  1. Open the Discord Developer Portal.
  2. Select New Application.
  3. Open the Bot tab and select Add Bot.
  4. Copy the bot token.
  5. Enable Message Content Intent under Privileged Gateway Intents.

Add the bot to OpenClaw:

openclaw channels add discord --token YOUR_BOT_TOKEN
Enter fullscreen mode Exit fullscreen mode

Invite the bot to your server using the OAuth2 URL from the Developer Portal. Grant it at least:

  • Send Messages
  • Read Message History

Add iMessage on macOS

iMessage support requires macOS because it uses the Messages app's private APIs.

Enable the channel:

openclaw channels add imessage
Enter fullscreen mode Exit fullscreen mode

When macOS prompts you, grant OpenClaw the required accessibility permissions. The local bridge monitors the Messages app and routes messages to your configured agent.

Send a test message to yourself or another test contact.

Verify channel status

List all channels:

openclaw channels list
Enter fullscreen mode Exit fullscreen mode

Example output:

Active channels:
- whatsapp (connected)
- telegram (connected)
- discord (connected)
- imessage (connected, macOS only)
Enter fullscreen mode Exit fullscreen mode

Each channel operates independently. The Gateway logs connection problems and attempts to reconnect automatically.

Configure Multi-Agent Routing

Multi-agent routing sends messages to different AI agents based on rules. You can route by:

  • Channel
  • Sender
  • Keyword
  • Priority
  • Custom JavaScript logic

Why use multiple agents?

Different tasks can benefit from different models:

  • Code questions can use a programming-focused model.
  • General chat can use a conversational model.
  • Documentation queries can use a model with a larger context window.
  • Sensitive messages can be routed to a local model.
  • Less critical tasks can use a lower-cost provider.

Default routing

By default, all messages use the agent selected during onboarding. This is sufficient for a basic setup, but explicit routing becomes useful as you add more channels and agents.

Route by channel

Send WhatsApp messages to a coding agent and Telegram messages to a general-purpose agent:

openclaw routing add --channel whatsapp --agent code-assistant
openclaw routing add --channel telegram --agent general-chat
Enter fullscreen mode Exit fullscreen mode

Route by sender

Route messages from a specific phone number to a dedicated agent:

openclaw routing add \
  --sender +1234567890 \
  --agent client-support
Enter fullscreen mode Exit fullscreen mode

Messages from that sender use client-support, regardless of the channel.

Route by keyword

Route messages containing specific words:

openclaw routing add \
  --keyword "debug" \
  --agent debugging-specialist

openclaw routing add \
  --keyword "docs" \
  --agent documentation-writer
Enter fullscreen mode Exit fullscreen mode

A message containing debug goes to debugging-specialist. Messages containing docs go to documentation-writer.

Set rule priorities

Higher-priority rules match first:

openclaw routing add \
  --channel whatsapp \
  --agent default \
  --priority 1

openclaw routing add \
  --sender +1234567890 \
  --agent vip \
  --priority 10
Enter fullscreen mode Exit fullscreen mode

A message from +1234567890 on WhatsApp uses the vip agent because priority 10 takes precedence over priority 1.

Add custom routing logic

For more complex behavior, create a JavaScript routing function:

// ~/.openclaw/routing.js
module.exports = function route(message) {
  const hour = new Date().getHours();

  if (hour >= 9 && hour < 17) {
    return 'work-agent';
  }

  return 'personal-agent';
};
Enter fullscreen mode Exit fullscreen mode

Register the function:

openclaw routing set-custom ~/.openclaw/routing.js
Enter fullscreen mode Exit fullscreen mode

The Gateway calls the function for each message. Return the agent name to determine where the message goes.

Isolate sessions

Each agent can have its own session. This keeps memory, context, and tool state separate between agents.

To share a session across agents:

openclaw routing add \
  --channel whatsapp \
  --agent code-assistant \
  --shared-session
Enter fullscreen mode Exit fullscreen mode

With this option, WhatsApp conversations share one session even when different agents handle individual messages.

Advanced Configuration

Use environment variables

OpenClaw reads configuration values from environment variables. Add them to ~/.openclaw/.env:

# AI provider settings
ANTHROPIC_API_KEY=your_key_here
OPENAI_API_KEY=your_key_here

# Gateway settings
GATEWAY_PORT=18789
GATEWAY_HOST=0.0.0.0

# Logging
LOG_LEVEL=info
LOG_FILE=~/.openclaw/gateway.log

# Session settings
SESSION_TIMEOUT=3600
MAX_CONTEXT_LENGTH=100000
Enter fullscreen mode Exit fullscreen mode

Restart the Gateway after changing configuration:

openclaw gateway restart
Enter fullscreen mode Exit fullscreen mode

Configure a custom AI provider

Add a custom provider:

openclaw providers add custom \
  --endpoint https://your-api.com/v1/chat \
  --auth-header "Authorization: Bearer YOUR_TOKEN" \
  --model your-model-name
Enter fullscreen mode Exit fullscreen mode

Use it in a routing rule:

openclaw routing add \
  --channel discord \
  --agent custom-agent \
  --provider custom
Enter fullscreen mode Exit fullscreen mode

Send events to a webhook

Configure a webhook for received messages:

openclaw webhooks add \
  --url https://your-service.com/webhook \
  --event message.received \
  --channel whatsapp
Enter fullscreen mode Exit fullscreen mode

Each WhatsApp message triggers a POST request to the configured service with the message data.

Add rate limits

Protect your provider quota with an agent-level limit:

openclaw limits set \
  --agent code-assistant \
  --max-requests 100 \
  --window 3600
Enter fullscreen mode Exit fullscreen mode

This limits the agent to 100 requests per hour. Excess requests are queued or rejected according to your configuration.

Back up and restore configuration

Export the configuration:

openclaw config export > openclaw-backup.json
Enter fullscreen mode Exit fullscreen mode

Restore it later:

openclaw config import openclaw-backup.json
Enter fullscreen mode Exit fullscreen mode

The export includes channels, routing rules, agents, and webhooks. API keys are not exported.

Real-World Routing Patterns

Freelance development

A freelance developer might use:

  • WhatsApp for client communication
  • Telegram for team discussions
  • Discord for open-source projects

Example agent assignments:

openclaw routing add --channel whatsapp --agent client-support
openclaw routing add --channel telegram --agent team-chat
openclaw routing add --channel discord --agent oss-helper
Enter fullscreen mode Exit fullscreen mode

This gives each channel an agent with an appropriate role and model.

API testing teams

An API testing team can route API-related questions to an agent that has access to internal API documentation:

openclaw routing add \
  --keyword "api" \
  --agent api-specialist

openclaw routing add \
  --keyword "endpoint" \
  --agent api-specialist
Enter fullscreen mode Exit fullscreen mode

Team members can ask questions such as:

How do I authenticate with the payment API?
Enter fullscreen mode Exit fullscreen mode

The api-specialist agent can then use its configured tools to query the API catalog and generate test cases.

Remote team coordination

A distributed team might use:

  • WhatsApp for urgent issues
  • Telegram for daily standups
  • Discord for technical discussions

A custom router can combine channel and time-based rules:

// Route urgent messages to a high-priority agent during work hours
module.exports = function route(message) {
  const hour = new Date().getHours();
  const isWorkHours = hour >= 9 && hour < 18;

  if (message.channel === 'whatsapp' && isWorkHours) {
    return 'urgent-agent';
  }

  if (message.channel === 'telegram') {
    return 'standup-agent';
  }

  return 'general-agent';
};
Enter fullscreen mode Exit fullscreen mode

This lets you use different agents for urgent issues, standups, and general conversations.

Troubleshoot Common Issues

WhatsApp disconnects frequently

WhatsApp connections can be sensitive to network changes, especially on laptops that switch between Wi-Fi networks.

Try the following:

  • Use a stable network connection.
  • Run OpenClaw on a server instead of a laptop.
  • Enable automatic reconnect:
openclaw channels config whatsapp --auto-reconnect true
Enter fullscreen mode Exit fullscreen mode

Telegram bot does not respond

Check that the bot has the required permissions, especially in group chats:

  • Send Messages
  • Read Message History

Test the connection:

openclaw channels test telegram
Enter fullscreen mode Exit fullscreen mode

If the token is invalid, regenerate it through @BotFather and update the channel:

openclaw channels update telegram --token NEW_TOKEN
Enter fullscreen mode Exit fullscreen mode

Discord bot is offline

Verify that Message Content Intent is enabled in the Discord Developer Portal:

  1. Select your application.
  2. Open the Bot tab.
  3. Open Privileged Gateway Intents.
  4. Enable Message Content Intent.

Restart the Gateway:

openclaw gateway restart
Enter fullscreen mode Exit fullscreen mode

API costs are high

Review recent usage:

openclaw stats \
  --agent code-assistant \
  --period 7d
Enter fullscreen mode Exit fullscreen mode

To reduce costs:

  • Use less expensive models for simple queries.
  • Enable rate limiting.
  • Route non-critical messages to local models.

Messages are delayed

The Gateway queues messages when an AI provider is slow. Check the queue:

openclaw queue status
Enter fullscreen mode Exit fullscreen mode

If the queue continues to grow, increase concurrency:

openclaw config set --max-concurrent-requests 10
Enter fullscreen mode Exit fullscreen mode

You can also add a backup agent:

openclaw agents add backup-agent \
  --provider openai \
  --model gpt-4

openclaw routing add --fallback backup-agent
Enter fullscreen mode Exit fullscreen mode

Session memory causes irrelevant responses

Sessions grow over time. Clear inactive sessions:

openclaw sessions clear --older-than 7d
Enter fullscreen mode Exit fullscreen mode

This removes sessions that have been inactive for more than seven days.

You can also reduce the session timeout:

openclaw config set --session-timeout 1800
Enter fullscreen mode Exit fullscreen mode

Sessions will then expire after 30 minutes of inactivity.

FAQ

Can I run OpenClaw on a Raspberry Pi?

Yes. Performance depends on the AI provider. Cloud APIs such as Anthropic or OpenAI can work with a Raspberry Pi 4 with 4 GB of RAM. Running local models requires more powerful hardware.

Does OpenClaw support voice messages?

Yes. The Gateway can handle voice messages from WhatsApp and Telegram. It transcribes them through a configured speech-to-text provider such as Whisper, Google Speech, or a custom provider, then sends the resulting text to the AI agent.

Can I use multiple AI providers at the same time?

Yes. Create separate agents with different providers:

openclaw agents add anthropic-agent \
  --provider anthropic \
  --model claude-sonnet-4-6

openclaw agents add openai-agent \
  --provider openai \
  --model gpt-4
Enter fullscreen mode Exit fullscreen mode

Route messages to the appropriate agent based on your requirements.

Is my data secure?

OpenClaw runs on your hardware. Messages only leave your system when they are sent to an external AI provider. If you use a local model, the messages and model processing remain on your machine.

You can enable session encryption:

openclaw config set --encrypt-sessions true
Enter fullscreen mode Exit fullscreen mode

This encrypts session data at rest using AES-256.

Can I contribute to OpenClaw?

Yes. OpenClaw is MIT licensed and hosted on GitHub. You can fork the repository, make changes, and submit a pull request.

What happens if the Gateway crashes?

The Gateway saves session state every 30 seconds. Restart it with:

openclaw gateway start
Enter fullscreen mode Exit fullscreen mode

Sessions resume from the latest checkpoint. Messages from the most recent checkpoint interval might not be preserved.

Can I run multiple Gateways?

Yes. Run one Gateway per machine or environment. Each Gateway has its own configuration, channels, and agents. Gateways do not share state unless you configure a shared database.

How do I update OpenClaw?

Update the global package:

npm update -g openclaw
Enter fullscreen mode Exit fullscreen mode

Restart the Gateway:

openclaw gateway restart
Enter fullscreen mode Exit fullscreen mode

Review the changelog for breaking changes before updating.

Conclusion

OpenClaw gives you one AI assistant across multiple messaging platforms. Install the Gateway, connect your channels, and define routing rules. It can then run in the background and handle conversations according to your configuration.

The main benefits are:

  • Self-hosting: You control the infrastructure and data flow.
  • Multi-channel support: Use one assistant across WhatsApp, Telegram, Discord, and iMessage.
  • Multi-agent routing: Assign the right model or agent to each task.
  • Open source: Avoid being locked into one proprietary ecosystem.

Start with one channel and one agent. Add channels, providers, and routing rules as your workflow grows. OpenClaw uses the same Gateway architecture for personal setups and team deployments.

If you are building APIs or testing integrations across platforms, Apidog provides API design and testing workflows that complement OpenClaw's conversational AI routing.

Next steps

  1. Install OpenClaw:
   npm install -g openclaw@latest
Enter fullscreen mode Exit fullscreen mode
  1. Run the onboarding wizard:
   openclaw onboard
Enter fullscreen mode Exit fullscreen mode
  1. Connect your first channel:
   openclaw channels login
Enter fullscreen mode Exit fullscreen mode
  1. Start the Gateway:
   openclaw gateway --port 18789
Enter fullscreen mode Exit fullscreen mode

For advanced usage, review the official documentation for custom plugins, webhook integrations, and deployment guides. You can also join the OpenClaw community on Discord to share setups, ask questions, and contribute to the project.

Top comments (0)