> For the complete documentation index, see [llms.txt](https://www.openclawbook.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.openclawbook.xyz/en/ch14-channel-routing-and-message-dispatch/14.1-channel-registry.md). Agents can also search and read this documentation through its [MCP server](https://www.openclawbook.xyz/~gitbook/mcp).

# 14.1 Channel Registry

> **Generated by**: Claude Opus 4.6 (initial draft) / Claude Opus 5 (`v2026.3.9` revision) **Token usage**: Input \~280,000 tokens, Output \~20,000 tokens (chapter total) **Source baseline**: `v2026.3.9` (`v2026.3.8-170-g665f67726`)

***

One of OpenClaw's core values is the **unified inbox**—regardless of whether messages come from WhatsApp, Telegram, Discord, or Slack, the Gateway can handle them in a unified manner. To achieve this, we first need a **Channel Registry** to manage all known message channels. This section will analyze the design of the registry and the channel capabilities declaration mechanism.

## 14.1.1 Channel Registration Mechanism

`src/channels/registry.ts` defines OpenClaw's core channel list and metadata.

### Core Channel List

```typescript
// src/channels/registry.ts
export const CHAT_CHANNEL_ORDER = [
  "telegram",
  "whatsapp",
  "discord",
  "googlechat",
  "slack",
  "signal",
  "imessage",
] as const;

export type ChatChannelId = (typeof CHAT_CHANNEL_ORDER)[number];
export const DEFAULT_CHAT_CHANNEL: ChatChannelId = "whatsapp";
```

`CHAT_CHANNEL_ORDER` not only defines the IDs of all core channels but also determines their display priority in the UI through array order—Telegram comes first because it is the "easiest way to get started."

Each channel comes with metadata (`ChannelMeta`) that describes its display name, documentation path, and description:

```typescript
// src/channels/registry.ts
const CHAT_CHANNEL_META: Record<ChatChannelId, ChannelMeta> = {
  telegram: {
    id: "telegram",
    label: "Telegram",
    selectionLabel: "Telegram (Bot API)",
    detailLabel: "Telegram Bot",
    docsPath: "/channels/telegram",
    blurb: "simplest way to get started — register a bot with @BotFather and get going.",
    systemImage: "paperplane",
  },
  whatsapp: {
    id: "whatsapp",
    label: "WhatsApp",
    selectionLabel: "WhatsApp (QR link)",
    blurb: "works with your own number; recommend a separate phone + eSIM.",
    systemImage: "message",
  },
  // discord, slack, signal, googlechat, imessage...
};
```

### Channel Aliases

For user input convenience, the registry supports channel aliases:

```typescript
// src/channels/registry.ts
export const CHAT_CHANNEL_ALIASES: Record<string, ChatChannelId> = {
  imsg: "imessage",
  "google-chat": "googlechat",
  gchat: "googlechat",
};
```

This way, users can input `imsg`, `google-chat`, or `gchat` in configuration or command line and they will all be correctly recognized. The `normalizeChannelId()` function handles this mapping uniformly:

```typescript
// src/channels/registry.ts
export function normalizeChannelId(raw?: string | null): ChatChannelId | null {
  const normalized = raw?.trim().toLowerCase();
  if (!normalized) return null;
  const resolved = CHAT_CHANNEL_ALIASES[normalized] ?? normalized;
  return CHAT_CHANNEL_ORDER.includes(resolved) ? resolved : null;
}
```

For external channels registered through the plugin system (such as Microsoft Teams, Matrix, etc.), `normalizeAnyChannelId()` further queries the plugin registry:

```typescript
// src/channels/registry.ts
export function normalizeAnyChannelId(raw?: string | null): ChannelId | null {
  const key = raw?.trim().toLowerCase();
  if (!key) return null;
  const registry = requireActivePluginRegistry();
  const hit = registry.channels.find((entry) => {
    const id = String(entry.plugin.id).trim().toLowerCase();
    if (id === key) return true;
    // Also check aliases declared by the plugin
    return (entry.plugin.meta.aliases ?? []).some(
      (alias) => alias.trim().toLowerCase() === key
    );
  });
  return hit?.plugin.id ?? null;
}
```

## 14.1.2 Channel Capabilities Declaration

Each channel has different capabilities—Telegram supports native slash commands, WhatsApp supports polls and reaction emojis, Discord supports threads—OpenClaw uses **capabilities declaration** (Channel Capabilities) to let the Gateway know what each channel can do.

Capabilities are declared in the channel's Dock layer (see 6.1.3):

```typescript
// Example: Telegram
capabilities: {
  chatTypes: ["direct", "group", "channel", "thread"],
  nativeCommands: true,      // Supports Bot API native slash commands
  blockStreaming: true,       // Supports block streaming (segmented streaming)
},

// Example: WhatsApp
capabilities: {
  chatTypes: ["direct", "group"],
  polls: true,               // Supports polls
  reactions: true,            // Supports emoji reactions
  media: true,                // Supports multimedia messages
},

// Example: Discord
capabilities: {
  chatTypes: ["direct", "channel", "thread"],
  polls: true,
  reactions: true,
  media: true,
  nativeCommands: true,       // Supports Slash Commands
  threads: true,              // Supports threads/posts
},
```

| Capability       | Description             | Supported Channels                                      |
| ---------------- | ----------------------- | ------------------------------------------------------- |
| `chatTypes`      | Supported chat types    | All                                                     |
| `nativeCommands` | Native slash commands   | Telegram, Discord, Slack                                |
| `blockStreaming` | Block streaming replies | Telegram, Google Chat                                   |
| `polls`          | Poll functionality      | WhatsApp, Discord                                       |
| `reactions`      | Emoji reactions         | WhatsApp, Discord, Slack, Signal, iMessage, Google Chat |
| `media`          | Multimedia messages     | WhatsApp, Discord, Slack, Signal, iMessage, Google Chat |
| `threads`        | Threads/posts           | Discord, Slack, Google Chat                             |

The Gateway checks the target channel's capabilities when processing messages. For example, if a channel doesn't support `reactions`, it won't attempt to send confirmation reactions; if it doesn't support `threads`, it won't include thread-related context in replies.

## 14.1.3 Channel Dock Layer

**Dock** (docking layer) is OpenClaw's lightweight abstraction for channel behavior. It provides a unified adapter interface between the registry and concrete channel implementations, allowing shared code (such as message dispatch, routing, command handling) to not depend on the full implementation of specific channels.

The `ChannelDock` type in `src/channels/dock.ts` defines the complete interface of the Dock:

```typescript
// src/channels/dock.ts
export type ChannelDock = {
  id: ChannelId;
  capabilities: ChannelCapabilities;        // Capabilities declaration
  commands?: ChannelCommandAdapter;          // Command adapter
  outbound?: {
    textChunkLimit?: number;                 // Outbound message chunk size limit
  };
  streaming?: ChannelDockStreaming;          // Streaming configuration
  elevated?: ChannelElevatedAdapter;         // Elevation adapter
  config?: {
    resolveAllowFrom?: (...) => string[];    // Allowlist resolution
    formatAllowFrom?: (...) => string[];     // Allowlist formatting
  };
  groups?: ChannelGroupAdapter;              // Group behavior adapter
  mentions?: ChannelMentionAdapter;          // @mention adapter
  threading?: ChannelThreadingAdapter;       // Threading adapter
  agentPrompt?: ChannelAgentPromptAdapter;   // Agent prompt adapter
};
```

Each core channel registers its own Dock in the `DOCKS` object. Taking WhatsApp as an example:

```typescript
// src/channels/dock.ts
whatsapp: {
  id: "whatsapp",
  capabilities: { chatTypes: ["direct", "group"], polls: true, reactions: true, media: true },
  commands: {
    enforceOwnerForCommands: true,   // Only the number owner can execute commands
    skipWhenConfigEmpty: true,
  },
  outbound: { textChunkLimit: 4000 },
  config: {
    resolveAllowFrom: ({ cfg, accountId }) =>
      resolveWhatsAppAccount({ cfg, accountId }).allowFrom ?? [],
    formatAllowFrom: ({ allowFrom }) =>
      allowFrom.map(entry => normalizeWhatsAppTarget(entry)).filter(Boolean),
  },
  groups: {
    resolveRequireMention: resolveWhatsAppGroupRequireMention,
    resolveToolPolicy: resolveWhatsAppGroupToolPolicy,
  },
  mentions: {
    stripPatterns: ({ ctx }) => {
      const selfE164 = (ctx.To ?? "").replace(/^whatsapp:/, "");
      return selfE164 ? [escapeRegExp(selfE164), `@${escapeRegExp(selfE164)}`] : [];
    },
  },
},
```

The value of `textChunkLimit` varies by channel:

| Channel                                                       | Chunk Limit     |
| ------------------------------------------------------------- | --------------- |
| Discord                                                       | 2000 characters |
| Telegram / WhatsApp / Slack / Signal / iMessage / Google Chat | 4000 characters |

For external channels registered through the plugin system, the `buildDockFromPlugin()` function automatically constructs the Dock from the plugin's properties:

```typescript
// src/channels/dock.ts
function buildDockFromPlugin(plugin: ChannelPlugin): ChannelDock {
  return {
    id: plugin.id,
    capabilities: plugin.capabilities,
    commands: plugin.commands,
    outbound: plugin.outbound?.textChunkLimit
      ? { textChunkLimit: plugin.outbound.textChunkLimit }
      : undefined,
    groups: plugin.groups,
    mentions: plugin.mentions,
    threading: plugin.threading,
    // ...
  };
}
```

The `listChannelDocks()` function merges core channels and plugin channels, sorts them by priority, and returns them:

```typescript
// src/channels/dock.ts
export function listChannelDocks(): ChannelDock[] {
  const baseEntries = CHAT_CHANNEL_ORDER.map((id) => ({
    id, dock: DOCKS[id], order: getChatChannelMeta(id).order,
  }));
  const pluginEntries = listPluginDockEntries();
  const combined = [...baseEntries, ...pluginEntries];
  combined.sort((a, b) => {
    const orderA = a.order ?? (indexA === -1 ? 999 : indexA);
    const orderB = b.order ?? (indexB === -1 ? 999 : indexB);
    return orderA !== orderB ? orderA - orderB : String(a.id).localeCompare(String(b.id));
  });
  return combined.map((entry) => entry.dock);
}
```

> **Design Philosophy**: The comments in the Dock layer emphasize the principle of "keeping it lightweight"—not introducing monitoring, web login, Puppeteer, and other heavyweight dependencies. This is because the Dock layer is widely referenced by various subsystems of the Gateway. If it indirectly loads the full implementation of specific channels, it would cause unnecessary memory overhead and startup delays. The heavyweight logic of specific channels should be placed in their respective plugin modules.

***

## Section Summary

OpenClaw's channel registry system has the following core characteristics:

1. **Two-layer registration**: Core channels are hardcoded in `CHAT_CHANNEL_ORDER`, external channels are dynamically registered through the plugin registry, and both are ultimately merged into a unified list
2. **Capabilities declaration**: Each channel explicitly declares the features it supports (chat types, reactions, polls, threads, etc.), and the Gateway decides available interaction methods accordingly
3. **Lightweight Dock layer**: Provides a unified behavior adapter interface between the registry and concrete implementations, keeping shared code paths independent of heavyweight channel implementations
4. **Alias system**: Supports multiple abbreviation forms for user input, lowering the configuration threshold

In the next section, we will analyze how inbound messages flow through the Gateway's processing pipeline—from raw channel messages to unified internal format.
