Channel System Overview
OpenClaw's channel system provides a unified abstraction over various messaging platforms (Telegram, Discord, WhatsApp, Slack, etc.), allowing the AI Agent to work without knowledge of which platform a message came from.
Source Location
src/channels/ # Channel abstraction layer
├── plugins/ # Channel plugin type definitions
│ └── types.ts # ChannelPlugin core interface
├── dock.ts # ChannelDock metadata registration
├── registry.ts # Channel registry
├── channel-config.ts # Channel config parsing
├── mention-gating.ts # @mention gating
├── command-gating.ts # Command gating
├── conversation-label.ts # Conversation labels
├── sender-identity.ts # Sender identity
├── sender-label.ts # Sender labels
├── session.ts # Channel sessions
├── typing.ts # Typing indicators
├── targets.ts # Message targets
├── location.ts # Location information
├── ack-reactions.ts # Acknowledgment reactions
├── reply-prefix.ts # Reply prefix
├── logging.ts # Channel logging
└── allowlists/ # Allowlists
src/telegram/ # Telegram implementation (~87 files)
src/discord/ # Discord implementation (~44 files)
src/slack/ # Slack implementation (~36 files)
src/signal/ # Signal implementation (~24 files)
src/imessage/ # iMessage implementation (~16 files)
src/line/ # LINE implementation (~36 files)
src/whatsapp/ # WhatsApp implementation
src/web/ # WebChat implementation (~48 files)Dual-Layer Abstraction
OpenClaw's channel system uses a dual-layer abstraction:
| Layer | File | Responsibility | When Loaded |
|---|---|---|---|
| Plugin | channels/plugins/types.ts | Runtime operations: send, receive, login | On demand |
| Dock | channels/dock.ts | Lightweight metadata: config, capabilities, limits | At startup |
Supported Channels
Source: src/channels/registry.ts
typescript
// src/channels/registry.ts (simplified)
const CHAT_CHANNEL_ORDER = [
"telegram",
"whatsapp",
"discord",
"googlechat",
"slack",
"signal",
"imessage",
];Channel metadata:
| Channel | SDK | Chunk Limit | Features |
|---|---|---|---|
| Telegram | grammy | 4000 chars | Markdown, buttons, polls |
| Discord | discord.js | 2000 chars | Embeds, threads, reactions |
| Baileys | Varies | Media, groups | |
| Slack | @slack/bolt | Varies | Block Kit, threads |
| Signal | signal-cli | Varies | End-to-end encryption |
| iMessage | AppleScript | Varies | macOS only |
| LINE | LINE SDK | Varies | Flex Messages |
Chapter Navigation
- Channel Abstraction -- ChannelPlugin interface, ChannelDock metadata
- Telegram Implementation -- grammy integration, message send/receive
- Discord Implementation -- discord.js integration, Embeds and threads
- Message Routing -- Outbound delivery, chunking, idempotency