Skip to main content

Channel System

The Channel system provides a uniform interface for integrating messaging platforms (Telegram, Discord, Slack, etc.), enabling ZeroClaw to communicate seamlessly across different channels.

Architecture Overview

Channel Trait

All channels implement the Channel trait from src/channels/traits.rs:

Message Types

Incoming Messages

Outgoing Messages

Telegram Channel Implementation

Real implementation from src/channels/telegram.rs:

Message Flow Diagram

Pairing and Authentication

Channels use PairingGuard for device authentication:

Progressive Message Updates

Some channels support updating messages as the response streams in:

Approval Prompts (Supervised Mode)

Channels can send interactive approval prompts:

Channel Configuration

Channels are configured in zeroclaw.toml:

Built-in Channels

Adding a New Channel

From AGENTS.md §7.2:
  1. Create channel file: src/channels/new_channel.rs
  2. Implement Channel trait:
  1. Register in mod.rs:
  1. Add tests: Cover auth/allowlist/health behavior

Best Practices

Message Handling

  • Validate user identity before processing
  • Respect platform rate limits
  • Handle message splitting for length limits
  • Preserve threading context when possible

Error Recovery

  • Implement exponential backoff for retries
  • Log connection errors at debug level
  • Surface persistent failures to user
  • Auto-reconnect on disconnect

Security

  • Never log message content or tokens
  • Use PairingGuard for authentication
  • Validate webhook signatures
  • Enforce allowed user/channel lists

Next Steps

  • Tools - Tool system and capabilities
  • Memory - Memory backends and persistence
  • Security - Security architecture