Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

通道 — 概述

通道是代理进行通信的消息界面。一个 ZeroClaw 实例可以同时绑定多个通道——同一个代理可以在 Discord、Telegram、电子邮件以及 REST 网关中回复,而无需你运行单独的程序。

通道是 zeroclaw-apiChannel trait 的实现。每个通道都在编译时通过特性进行门控,因此最小化构建仅包含你所需的通道。

分类

聊天平台

实时消息传递,代理可以保持对话,通过推送或长轮询接收新消息的通知,并以机器人用户的身份进行回复。

通道功能标志专用指南
矩阵channel-matrix矩阵
Mattermostchannel-mattermostMattermost
channel-line
Nextcloud Talkchannel-nextcloud-talkNextcloud Talk
信号channel-signalSignal
WhatsApp Cloud APIchannel-whatsapp-cloudWhatsApp
WhatsApp Webwhatsapp-webWhatsApp
Discord, Slack, Telegram, iMessage, WeCom Bot Webhook, WeCom AI Bot Long Connection, WeChat personal iLink Bot, DingTalk, Lark, QQ, IRC, Mochat, Notion按通道其他聊天平台

社交与广播

一对多或公共提要集成。

通道功能标志协议 / 服务
Blueskychannel-blueskyAT 协议
诺斯特channel-nostrNIP-01 中继
Twitter / Xchannel-twitterAPI v2
Redditchannel-redditJSON API

请参阅 社交渠道

电子邮件

通道功能标志备注
IMAP / SMTPchannel-email经典的基于轮询的收件箱
Gmail 推送channel-gmail-pushGoogle Pub/Sub 推送通知 — 实时,无需轮询

请参阅 电子邮件

语音与电话

通道功能标志服务
ClawdTalkchannel-clawdtalkTelnyx SIP 实时语音
语音通话channel-voice-callTwilio / Telnyx / Plivo
语音唤醒channel-voice-wake本地唤醒词检测
TTSchannel-tts出站语音合成(OpenAI、ElevenLabs、Google Cloud、Edge、Piper)

请参阅 语音与电话

Webhooks 与编程

通道功能标志形状
Webhook(始终与网关保持连接)入站 HTTP → 代理
命令行界面始终开启本地标准输入/标准输出
网关 REST/WS始终开启HTTP + WebSocket
ACP(代理客户端协议)(始终在运行时启用)通过 stdio 的 JSON-RPC 2.0 — 编辑器/IDE 会话

请参阅 WebhooksACP

配置

Modern channel instances are configured under [channels.<type>.<alias>], with default as the common first alias:

[channels.discord.default]
enabled = true
bot_token = "..."
allowed_users = ["123456789012345678"]
reply_to_mentions_only = false

[agents.assistant]
enabled = true
channels = ["discord.default"]

The channels entry binds the channel alias to the agent that should answer it. Some older per-channel guides still show legacy flat examples; prefer the alias shape above for new config. Channel-specific options live under the same block. Common keys across channels:

它的作用
enabled在不删除部分的情况下切换开/关
allowed_users白名单 — 为空表示允许所有
allowed_destinations限制机器人回答的房间/频道/线程
reply_to_mentions_only忽略未 @提及机器人的消息
provider覆盖此频道的默认模型
draft_update_interval_ms流式编辑频率(默认 500 毫秒)

配对

Most channels require pairing — a one-time handshake that binds an incoming message source to the agent’s policy. zeroclaw onboard channels walks you through pairing each channel you configure; use zeroclaw channel bind-telegram for Telegram-specific identities and the channel-specific guide for channels such as WhatsApp or Signal. Without pairing, the channel rejects everything.

原因:一个拥有公开 Telegram 机器人令牌且未配对的代理是一个可公开访问的 shell。配对是访问的门槛。

流媒体功能

通道声明其支持的流式传输类型——有关功能矩阵以及 supports_draft_updates / supports_multi_message_streaming 的含义,请参阅 Providers → Streaming

添加频道

实现新频道意味着在 crates/zeroclaw-channels/src/ 中添加一个实现 Channel 特征的文件。可以参考现有形状相似的频道:discord.rs 用于推送式,email_channel.rs 用于轮询式,webhook.rs 用于 HTTP 驱动式。