Skip to content

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:

LayerFileResponsibilityWhen Loaded
Pluginchannels/plugins/types.tsRuntime operations: send, receive, loginOn demand
Dockchannels/dock.tsLightweight metadata: config, capabilities, limitsAt 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:

ChannelSDKChunk LimitFeatures
Telegramgrammy4000 charsMarkdown, buttons, polls
Discorddiscord.js2000 charsEmbeds, threads, reactions
WhatsAppBaileysVariesMedia, groups
Slack@slack/boltVariesBlock Kit, threads
Signalsignal-cliVariesEnd-to-end encryption
iMessageAppleScriptVariesmacOS only
LINELINE SDKVariesFlex Messages

Chapter Navigation

  1. Channel Abstraction -- ChannelPlugin interface, ChannelDock metadata
  2. Telegram Implementation -- grammy integration, message send/receive
  3. Discord Implementation -- discord.js integration, Embeds and threads
  4. Message Routing -- Outbound delivery, chunking, idempotency

OpenClaw Source Code Tutorial