> 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/ch20-core-channel-implementations/20.5-other-core-channels.md). Agents can also search and read this documentation through its [MCP server](https://www.openclawbook.xyz/~gitbook/mcp).

# 20.5 Other Core Channels

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

***

Beyond the four major channels—WhatsApp, Telegram, Discord, and Slack—OpenClaw also includes Signal, iMessage (including BlueBubbles), and WebChat channels. Each has unique technical architecture; this section analyzes them one by one.

***

## 20.5.1 Signal (signal-cli)

### signal-cli and JSON-RPC

Signal is a messaging application renowned for end-to-end encryption. Since Signal doesn't provide an official Bot API, OpenClaw integrates indirectly through [signal-cli](https://github.com/AsamK/signal-cli), a third-party command-line tool. signal-cli wraps Signal's Java client library as a command-line interface and provides HTTP mode for programmatic calls.

> **Sidebar: signal-cli**
>
> signal-cli is a Signal client command-line tool written in Java that can register Signal accounts and send/receive messages without a phone. It supports `daemon` mode, which after startup exposes JSON-RPC 2.0 API and SSE (Server-Sent Events) event streams through HTTP interface.

The overall architecture is as follows:

```
signal-cli daemon (Java process)
    ├── HTTP JSON-RPC API  ← Send messages, get attachments
    └── SSE /api/v1/events ← Receive real-time events
         │
         ▼
OpenClaw Signal Monitor
    ├── spawnSignalDaemon()      ← Auto-start daemon
    ├── signalRpcRequest()       ← JSON-RPC client
    ├── streamSignalEvents()     ← SSE event stream parsing
    └── runSignalSseLoop()       ← Event loop with auto-reconnect
```

### Auto-Start Daemon

OpenClaw can automatically manage the signal-cli process lifecycle:

```typescript
// src/signal/daemon.ts
export function spawnSignalDaemon(opts: SignalDaemonOpts): SignalDaemonHandle {
  const args = buildDaemonArgs(opts);
  // Example: ["daemon", "--http", "127.0.0.1:8080", "--no-receive-stdout"]
  
  const child = spawn(opts.cliPath, args, {
    stdio: ["ignore", "pipe", "pipe"],
  });
  
  // Log classification: distinguish normal logs from errors
  child.stderr?.on("data", (data) => {
    for (const line of data.toString().split(/\r?\n/)) {
      const kind = classifySignalCliLogLine(line);
      if (kind === "error") error(`signal-cli: ${line.trim()}`);
      else if (kind === "log") log(`signal-cli: ${line.trim()}`);
    }
  });
  
  return {
    pid: child.pid,
    stop: () => { if (!child.killed) child.kill("SIGTERM"); }
  };
}
```

signal-cli's log classification logic detects keywords like `ERROR`, `WARN`, `FAILED`, `SEVERE` to determine log level:

```typescript
export function classifySignalCliLogLine(line: string): "log" | "error" | null {
  const trimmed = line.trim();
  if (!trimmed) return null;
  if (/\b(ERROR|WARN|WARNING)\b/.test(trimmed)) return "error";
  if (/\b(FAILED|SEVERE|EXCEPTION)\b/i.test(trimmed)) return "error";
  return "log";
}
```

After startup, OpenClaw polls the `/api/v1/check` endpoint to wait for daemon readiness:

```typescript
await waitForSignalDaemonReady({
  baseUrl,
  timeoutMs: startupTimeoutMs,     // Default 30 seconds, max 120 seconds
  logAfterMs: 10_000,              // Start printing wait logs after 10 seconds
  pollIntervalMs: 150,             // Poll every 150ms
  check: async () => {
    const res = await signalCheck(params.baseUrl, 1000);
    return res.ok ? { ok: true } : { ok: false, error: res.error };
  },
});
```

### JSON-RPC Client

All interactions with signal-cli use the standard JSON-RPC 2.0 protocol:

```typescript
// src/signal/client.ts
export async function signalRpcRequest<T>(
  method: string,
  params: Record<string, unknown> | undefined,
  opts: SignalRpcOptions,
): Promise<T> {
  const body = JSON.stringify({
    jsonrpc: "2.0",
    method,              // Example: "send", "getAttachment", "sendReceipt"
    params,
    id: randomUUID(),    // Unique ID for each request
  });
  
  const res = await fetchWithTimeout(
    `${baseUrl}/api/v1/rpc`,
    { method: "POST", headers: { "Content-Type": "application/json" }, body },
    opts.timeoutMs ?? 10_000,
  );
  
  const parsed = JSON.parse(text) as SignalRpcResponse<T>;
  if (parsed.error) {
    throw new Error(`Signal RPC ${parsed.error.code}: ${parsed.error.message}`);
  }
  return parsed.result as T;
}
```

### SSE Event Stream and Auto-Reconnect

Signal's real-time message reception uses SSE (Server-Sent Events) protocol. OpenClaw implements a complete SSE client, including manual event stream parsing:

```typescript
// src/signal/client.ts (simplified)
export async function streamSignalEvents(params) {
  const res = await fetch(url, {
    headers: { Accept: "text/event-stream" },
    signal: params.abortSignal,
  });
  
  const reader = res.body.getReader();
  const decoder = new TextDecoder();
  let buffer = "";
  let currentEvent: SignalSseEvent = {};
  
  while (true) {
    const { value, done } = await reader.read();
    if (done) break;
    buffer += decoder.decode(value, { stream: true });
    
    // Parse SSE protocol line by line: event:, data:, id:, blank line separates events
    // ...
  }
}
```

> **Sidebar: Server-Sent Events (SSE)**
>
> SSE is an HTTP-based server push protocol. The server sends events in text format through a persistent HTTP connection. Each event consists of `event:`, `data:`, `id:` fields, separated by blank lines. Unlike WebSocket, SSE is unidirectional (server→client), but simpler and has built-in auto-reconnect.

The outer `runSignalSseLoop()` handles automatic reconnection when connections drop, using exponential backoff strategy:

```typescript
// src/signal/sse-reconnect.ts
const DEFAULT_RECONNECT_POLICY: BackoffPolicy = {
  initialMs: 1_000,   // Initial 1 second
  maxMs: 10_000,      // Maximum 10 seconds
  factor: 2,          // Double growth
  jitter: 0.2,        // 20% random jitter
};

export async function runSignalSseLoop(params) {
  let reconnectAttempts = 0;
  
  while (!abortSignal?.aborted) {
    try {
      await streamSignalEvents({
        onEvent: (event) => {
          reconnectAttempts = 0;  // Reset counter on event received
          onEvent(event);
        },
      });
      // Normal end → wait and reconnect
      const delayMs = computeBackoff(reconnectPolicy, ++reconnectAttempts);
      await sleepWithAbort(delayMs, abortSignal);
    } catch (err) {
      // Exception → wait longer and reconnect
      const delayMs = computeBackoff(reconnectPolicy, ++reconnectAttempts);
      await sleepWithAbort(delayMs, abortSignal);
    }
  }
}
```

### Message Sending

Signal message sending also uses JSON-RPC, supporting three target types: phone numbers, usernames, and groups:

```typescript
// src/signal/send.ts
type SignalTarget =
  | { type: "recipient"; recipient: string }   // Phone number
  | { type: "group"; groupId: string }          // Group ID
  | { type: "username"; username: string };      // Signal username

export async function sendMessageSignal(to, text, opts) {
  // Markdown → Signal rich text styles
  const formatted = markdownToSignalText(message, { tableMode });
  message = formatted.text;
  textStyles = formatted.styles;  // Signal supports text-style attribute
  
  const params = { message, account };
  if (textStyles.length > 0) {
    params["text-style"] = textStyles.map(
      (s) => `${s.start}:${s.length}:${s.style}`
    );
  }
  
  return signalRpcRequest("send", params, { baseUrl });
}
```

Signal's text styles use offset notation (`start:length:style`), for example `0:5:BOLD` means bold the first 5 characters.

***

## 20.5.2 BlueBubbles (Recommended iMessage Integration)

BlueBubbles is OpenClaw's recommended iMessage integration method. It runs a BlueBubbles server on Mac, exposing iMessage send/receive capabilities as HTTP API.

> **Sidebar: iMessage Integration**
>
> iMessage is Apple's closed-ecosystem messaging protocol with no public API. BlueBubbles is a third-party open-source project that runs a server process on macOS, monitoring the system's Messages database (chat.db), and provides message send/receive capabilities through HTTP/WebSocket interface. This is currently one of the most reliable ways to integrate iMessage into third-party applications.

Unlike schemes that directly manipulate the iMessage database, BlueBubbles runs as an independent server requiring `serverUrl` and `password` configuration.

In OpenClaw, BlueBubbles is implemented as an **extension plugin** (not a core channel), located in the plugin system. Its core configuration check is as follows:

```typescript
// src/channels/plugins/status-issues/bluebubbles.ts
export function collectBlueBubblesStatusIssues(accounts) {
  for (const entry of accounts) {
    if (!configured) {
      issues.push({
        channel: "bluebubbles",
        kind: "config",
        message: "Not configured (missing serverUrl or password).",
        fix: "Run: openclaw channels add bluebubbles --http-url <server-url> --password <password>",
      });
    }
    if (probe && probe.ok === false) {
      issues.push({
        channel: "bluebubbles",
        kind: "runtime",
        message: `BlueBubbles server unreachable${errorDetail}`,
      });
    }
  }
}
```

BlueBubbles and native iMessage (discussed in the next section) are mutually exclusive—when BlueBubbles configuration exists, OpenClaw prioritizes it and automatically skips enabling native iMessage:

```yaml
# Configuration example
channels:
  bluebubbles:
    serverUrl: "http://mac-mini.local:1234"
    password: "your-bluebubbles-password"
    dmPolicy: "pairing"
```

BlueBubbles' message routing system shares the same `outbound-session.ts` logic with other channels, supporting both phone numbers and `chat_guid` target formats.

***

## 20.5.3 iMessage Legacy (macOS Native imsg)

When BlueBubbles cannot be used, OpenClaw provides a solution to directly manipulate iMessage through macOS native interfaces. This method requires running an RPC command-line tool called `imsg` on the macOS machine.

### imsg RPC Client

`imsg` is a command-line process communicating via JSON-RPC 2.0 protocol. OpenClaw interacts with it through stdin/stdout pipes:

```typescript
// src/imessage/client.ts
export class IMessageRpcClient {
  private child: ChildProcessWithoutNullStreams | null = null;
  private readonly pending = new Map<string, PendingRequest>();
  private nextId = 1;
  
  async start(): Promise<void> {
    const args = ["rpc"];
    if (this.dbPath) args.push("--db", this.dbPath);
    
    const child = spawn(this.cliPath, args, {
      stdio: ["pipe", "pipe", "pipe"],  // stdin, stdout, stderr all managed
    });
    this.child = child;
    this.reader = createInterface({ input: child.stdout });
    
    // Read JSON-RPC responses line by line
    this.reader.on("line", (line) => {
      this.handleLine(line.trim());
    });
  }
  
  async request<T>(method: string, params?, opts?): Promise<T> {
    const payload = { jsonrpc: "2.0", id: this.nextId++, method, params };
    const line = `${JSON.stringify(payload)}\n`;
    
    return new Promise((resolve, reject) => {
      const timer = setTimeout(() => reject(new Error("timeout")), timeoutMs);
      this.pending.set(String(id), { resolve, reject, timer });
    });
    
    this.child.stdin.write(line);  // Write to stdin
  }
}
```

This stdio pipe-based JSON-RPC communication pattern is common in systems programming. Its advantages are:

* No network port needed, avoiding port conflicts
* Process lifecycle directly managed by parent process
* Supports bidirectional async communication (requests/responses + notifications)

### Message Monitoring and Subscription

iMessage message monitoring is implemented via the `watch.subscribe` RPC method:

```typescript
// src/imessage/monitor/monitor-provider.ts
const client = await createIMessageRpcClient({
  cliPath,
  dbPath,
  runtime,
  onNotification: (msg) => {
    if (msg.method === "message") {
      void handleMessage(msg.params);  // Received new message
    } else if (msg.method === "error") {
      runtime.error?.(`imessage: watch error ${JSON.stringify(msg.params)}`);
    }
  },
});

// Subscribe to new message notifications
const result = await client.request("watch.subscribe", {
  attachments: includeAttachments,
});
subscriptionId = result?.subscription ?? null;

// Wait for connection close (blocks until process exits or abort)
await client.waitForClose();
```

The `imsg` tool continuously monitors macOS's Messages database (`~/Library/Messages/chat.db`) in the background. When new messages are detected, it pushes notifications to OpenClaw via JSON-RPC.

### Remote Mac Support

A clever design is OpenClaw's support for remotely accessing iMessage on another Mac via SSH. It automatically detects SSH wrapper scripts from the CLI path:

```typescript
async function detectRemoteHostFromCliPath(cliPath: string) {
  const content = await fs.readFile(expanded, "utf8");
  
  // Match: exec ssh -T openclaw@192.168.64.3 /opt/homebrew/bin/imsg "$@"
  const userHostMatch = content.match(/\bssh\b[^\n]*?\s+([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/);
  if (userHostMatch) return userHostMatch[1];
  
  // Match: exec ssh -T mac-mini imsg "$@"
  const hostOnlyMatch = content.match(/\bssh\b[^\n]*?\s+([a-zA-Z][a-zA-Z0-9._-]*)\s+\S*\bimsg\b/);
  return hostOnlyMatch?.[1];
}
```

After detecting the remote host, it's recorded in the `MediaRemoteHost` field of the message context for use by the media handling system (remote file paths need to be fetched via SSH).

### Echo Detection

The iMessage channel has a unique problem: messages sent through `imsg` are also monitored (because the Messages database records all messages). OpenClaw uses `SentMessageCache` to filter these "echoes":

```typescript
class SentMessageCache {
  private cache = new Map<string, number>();
  private readonly ttlMs = 5000;  // 5 second window
  
  remember(scope: string, text: string): void {
    this.cache.set(`${scope}:${text.trim()}`, Date.now());
  }
  
  has(scope: string, text: string): boolean {
    const timestamp = this.cache.get(key);
    return timestamp ? (Date.now() - timestamp <= this.ttlMs) : false;
  }
}
```

Each message send is recorded in the cache. When receiving new messages, it checks if they match within the 5-second window. Scope is isolated per conversation to avoid false positives for identical text in different conversations.

### Message Payload

iMessage message format contains rich metadata:

```typescript
// src/imessage/monitor/types.ts
export type IMessagePayload = {
  id?: number;
  chat_id?: number;              // macOS internal conversation ID
  sender?: string;               // Phone number or Apple ID
  is_from_me?: boolean;          // Whether sent by self
  text?: string;
  reply_to_id?: number | string; // Quote reply reference
  reply_to_text?: string;
  reply_to_sender?: string;
  created_at?: string;
  attachments?: IMessageAttachment[];
  chat_identifier?: string;      // Like "iMessage;-;+1234567890"
  chat_guid?: string;            // Globally unique ID
  chat_name?: string;            // Group name
  participants?: string[];       // Group member list
  is_group?: boolean;
};
```

OpenClaw supports multiple addressing formats for iMessage targets:

| Format           | Example                                 | Description                |
| ---------------- | --------------------------------------- | -------------------------- |
| Phone number     | `+15551234567`                          | Most common                |
| chat\_id         | `imessage:chat:42`                      | macOS internal database ID |
| chat\_guid       | `imessage:chat_guid:iMessage;-;+155...` | Globally unique            |
| chat\_identifier | `imessage:chat_identifier:+155...`      | Conversation identifier    |

***

## 20.5.4 WebChat (Gateway Built-in Web Chat)

WebChat is OpenClaw Gateway's built-in web chat interface. It doesn't depend on any third-party services but communicates directly with the Agent through Gateway's WebSocket protocol.

### Architecture Characteristics

Unlike other channels receiving messages through external APIs/SDKs, WebChat is a native component of the Gateway protocol:

```
Browser WebChat UI
    │
    ▼
WebSocket connection
    │
    ▼
Gateway WebSocket server
    ├── ws-connection.ts          ← Connection management
    ├── message-handler.ts        ← Message routing
    └── server-methods/chat.ts    ← chat.send method
         │
         ▼
dispatchInboundMessage()         ← Unified inbound dispatch
```

WebChat's message channel identifier is `"webchat"`, defined in:

```typescript
// src/utils/message-channel.ts
export const INTERNAL_MESSAGE_CHANNEL = "webchat" as const;
```

### WebSocket Connection

WebChat clients connect to the Gateway server via WebSocket. After connection establishment, handshake is completed via `connect` message:

```typescript
// src/gateway/server/ws-connection/message-handler.ts
`webchat connected conn=${connId} remote=${remoteAddr} client=${clientLabel} ` +
`${connectParams.client.mode} v${connectParams.client.version}`
```

Client information includes mode and version number:

```typescript
// src/gateway/protocol/client-info.ts
export const GATEWAY_CLIENT_MODE = {
  WEBCHAT_UI: "webchat-ui",
  WEBCHAT: "webchat",
  // ...
};
```

### chat.send Method

WebChat message sending uses the `chat.send` method in Gateway's RPC protocol. It directly calls `dispatchInboundMessage()` to dispatch to the Agent:

```typescript
// src/gateway/server-methods/chat.ts (conceptually simplified)
const ctxPayload = {
  Body: messageText,
  Provider: "webchat",
  Surface: "webchat",
  ChatType: "direct",
  // ...
};

const { queuedFinal } = await dispatchInboundMessage({
  ctx: ctxPayload,
  cfg,
  dispatcher,
  replyOptions: { /* ... */ },
});
```

### Differences from Other Channels

WebChat has several important differences from other channels:

| Feature           | WebChat                            | Other Channels                     |
| ----------------- | ---------------------------------- | ---------------------------------- |
| Message source    | Direct WebSocket RPC               | External API/SDK                   |
| Persistence       | Gateway-managed sessions           | External platform message history  |
| Real-time         | Native real-time                   | Depends on platform push delay     |
| Outbound delivery | Not supported via `openclaw agent` | Supported                          |
| Heartbeat config  | Uses `channels.defaults`           | Has independent per-channel config |

WebChat doesn't support active message delivery via CLI's `openclaw agent` command:

```typescript
// src/infra/outbound/targets.ts
`Delivering to WebChat is not supported via ${formatCliCommand("openclaw agent")}; ` +
`use WhatsApp/Telegram or run with --deliver=false.`
```

### Heartbeat Visibility

WebChat has unique Heartbeat visibility control—since WebChat is typically used for development debugging, it suppresses Heartbeat broadcasts by default:

```typescript
// src/infra/heartbeat-visibility.ts
if (channel === "webchat") {
  // webchat uses channels.defaults.heartbeat config
  // No per-channel config
}
```

### Sessions and Queues

WebChat's session and queue system also has special handling:

```typescript
// src/config/sessions/group.ts
const getGroupSurfaces = () => new Set([...listDeliverableMessageChannels(), "webchat"]);

// src/config/types.queue.ts
type QueueConfig = {
  webchat?: QueueMode;  // Independent webchat queue config
};
```

WebChat is considered a member of deliverable channel groups (Group Surfaces), meaning Agents processing messages from WebChat can access the same context information and tool set as other channels.

***

## Section Summary

1. **Signal channel integrates indirectly through signal-cli**, using JSON-RPC 2.0 protocol for sending messages and SSE protocol for receiving events. OpenClaw can automatically start and manage signal-cli daemon processes and includes built-in SSE reconnection loops with exponential backoff.
2. **BlueBubbles is OpenClaw's recommended iMessage integration**, running a BlueBubbles server on Mac to expose HTTP API. It's implemented as an extension plugin, mutually exclusive with native iMessage.
3. **iMessage Legacy uses the `imsg` RPC tool** to directly manipulate macOS Messages database, using stdio pipe JSON-RPC communication. Unique designs include SSH support for remote Macs and 5-second window echo detection.
4. **WebChat is Gateway's built-in web chat**, independent of external services, communicating directly with the Agent through WebSocket RPC. It's the only channel not supporting active outbound delivery but has the lowest latency and simplest configuration.
5. **These channels collectively exemplify OpenClaw's channel abstraction design**—regardless of underlying protocol (HTTP API, SSE, stdio pipe, or WebSocket), all messages are ultimately normalized to a unified `MsgContext` structure and processed by `dispatchInboundMessage()`.

***

> ### 🔬 Going Deeper: 20.6 Source Deep Dive
>
> That's the end of the chapter's main text. If you're going to **modify this code**, or reproduce it in your own project, read on: [**20.6 Source Deep Dive: Three Long-Lived Connections, Two Streaming Modes**](https://www.openclawbook.xyz/en/ch20-core-channel-implementations/20.6-source-deep-dive-three-connections-two-streaming-modes.md) traces the real implementation line by line along with the issues behind it, at a noticeably higher information density.
>
> **The main text is for understanding structure; the deep dive is for understanding trade-offs.**
