Channels Reference
本页是 channel catalog status、config blocks、secret references、access policy fields、 doctor checks、live-smoke readiness 和 reload semantics 的权威参考。各 channel setup 页面应 链接到这里,而不是重复 field tables。
Setup 与运行循环
每个已实现 channel 都使用同一套循环:
anyy setup channels CHANNEL --write-config
anyy channels doctor CHANNEL
anyy gateway start
anyy channels reload
setup 写入 config 并保存提供的 secrets。doctor 检查本地 readiness。gateway start 运行
adapters。channels reload 要求正在运行的 gateway 应用编辑后的 channel config,而不必完整重启。
已实现 Channels
运行时 channel catalog 当前将这些 channels 标记为 implemented:
| Channel | Label | Aliases |
|---|---|---|
telegram | Telegram | tg |
discord | Discord | - |
slack | Slack | - |
whatsapp | wa | |
facebook | Facebook Messenger | facebook_messenger, messenger, meta |
email | imap, smtp | |
sms | SMS (Twilio) | twilio, sms_twilio |
dingtalk | DingTalk | ding_talk |
feishu | Feishu / Lark | lark |
weixin | Weixin / WeChat | wechat, weixin_wechat |
qqbot | QQ Bot | qq, qq_bot |
irc | IRC | - |
line | LINE | - |
这些 catalog entries 已规划,但没有注册 runtime adapters:
| Channel | Label |
|---|---|
yuanbao | Yuanbao |
google_chat | Google Chat |
Doctor 会把 planned channels 报为 configured/planned,而不会假装它们能投递消息。
能力矩阵
下表来自已注册 channel descriptors。它描述 runtime adapter 声明的能力;平台配置和 access policy 仍可能阻止某个 conversation 或 delivery path。
| Channel | Transport | Conversations | Threads | Inbound media | Outbound media | Typing | Live smoke |
|---|---|---|---|---|---|---|---|
telegram | polling | DM, groups | No | Yes | No | Yes | Yes |
discord | lifecycle/socket | DM, groups | Yes | Yes | No | No | Yes |
slack | lifecycle/socket | DM, groups | Yes | Yes | No | No | Yes |
whatsapp | polling | DM, groups | No | Yes | No | Yes | Yes |
facebook | webhook | DM | No | Yes | No | Yes | Yes |
email | polling | mailbox | Yes | No | No | No | Yes |
sms | webhook | DM | No | No | No | No | Yes |
dingtalk | lifecycle/socket | DM, groups | No | No | No | No | Yes |
feishu | lifecycle/websocket, webhook fallback | DM, groups | Yes | Yes | No | No | Yes |
weixin | polling | DM | No | Yes | image, video, audio, voice, file | Yes | No |
qqbot | lifecycle/socket | DM, groups | No | No | No | No | Yes |
irc | lifecycle/socket | DM, groups | No | No | No | No | Yes |
line | webhook | DM, groups | No | No | No | No | Yes |
Channel Config Blocks
Channel blocks 位于 config.yaml 的 channels.<name> 下。常见字段:
| 字段 | 含义 |
|---|---|
enabled | Gateway 是否应运行该 adapter。 |
account_id | 平台账号/bot 的本地标签,常用于 identity 和 secret paths。 |
dm_policy | Direct-message access policy。 |
group_policy | Adapter 支持 group conversations 时的 group/channel access policy。 |
allow_from | allowlist policies 允许的 sender/user IDs。 |
allow_groups | allowlist group policies 允许的 group/channel IDs。 |
send_chunk_chars | 对有 message-size limit 的 adapters,限制 outgoing text chunk size。 |
media_max_bytes | 会 fetch media 的 adapters 的最大 inbound media download size。 |
各 channel 在推荐 setup/default mode 下的字段:
| Channel | Required config fields | Required secret refs | Optional secret refs |
|---|---|---|---|
telegram | - | token_ref | - |
discord | - | bot_token_ref | - |
slack | - | bot_token_ref | app_token_ref |
weixin | - | token_ref | - |
dingtalk | client_id | client_secret_ref | - |
qqbot | app_id | client_secret_ref | - |
facebook | page_id | page_access_token_ref | webhook_verify_token_ref, app_secret_ref |
email | address, imap_host, smtp_host | password_ref | - |
irc | host, nick | - | password_ref |
sms | account_sid, from_number | auth_token_ref | - |
line | - | channel_access_token_ref, channel_secret_ref | - |
whatsapp | - | - | bridge_token_ref |
feishu | app_id | app_secret_ref | tenant_access_token_ref, verification_token_ref, encrypt_key_ref |
可用时使用 anyy setup channels CHANNEL --write-config;它会写入 config block,并把提供的
secrets 存进 profile-local secret files。
上表遵循文档化 setup path 和默认 adapter mode。有些 adapter parser 可以接受更窄的配置块,但 setup 生成的 config 是推荐的运行基线。
Secret References
Channel secret fields 接受标准 secret ref scheme:
| Ref | 含义 |
|---|---|
secret:path/name | 读取 <home>/secrets/path/name。 |
env:NAME | 读取环境变量 NAME。 |
file:/path/to/file | 读取任意文件。 |
literal:value | 使用 literal value。真实凭据应避免使用。 |
Doctor 会检查本地 channel probe 已知的 secret refs。缺失被 probe 标记为 required 的 refs 会让 该 channel doctor check 失败。Optional refs 只有在存在时才检查。
通过 doctor 不代表每种 adapter mode 都能完成认证。例如,文档化的 Feishu websocket setup 需要
app_id 和 app_secret_ref。
不要把平台 tokens 粘贴到 channel docs、chat messages、screenshots 或 issue reports。请把它们
保存为 secret: refs,或通过 service-manager environment 注入。
Access Policies
Access policies 是 adapter-owned strings,但已实现 channel setup 使用这些常见值:
| Policy | 含义 |
|---|---|
open | 接受平台投递给 adapter 的任何人的消息。 |
allowlist | 只接受列在 allow_from 或 allow_groups 中的 IDs。 |
pairing | 接受已经 paired 的 identities。 |
mention | 在 groups 中,只在 bot 被提及或被明确寻址时回复。 |
disabled | 拒绝该 conversation type。 |
不是每个 adapter 都使用每种 policy。请查看该 channel 的 setup page,了解推荐 policy 和平台特定 identity format。
Access policy 是 channel-level authorization。它不会改变 Anyy 的 tool permissions、 provider credentials 或 profile boundaries。
Live Smoke Checks
anyy channels doctor CHANNEL 会报告 live-smoke readiness,但 doctor 本身不会联系外部平台
API。它只报告真正 live test 是否具备足够 environment。
所有 live tests 的 gate 是:
ANYY_LIVE_CHANNEL_TESTS=1
当 channel-specific variables 也设置完毕时,live-smoke plan 会报告 ready,并打印 Go test 命令,例如:
ANYY_LIVE_CHANNEL_TESTS=1 go test ./internal/channels/telegram -run TestLive -count=1
只用测试账号或安全平台目标运行 live smoke。
Reload Semantics
Channels 在 resident gateway 内运行。编辑 channel config 后,重启 gateway 或请求 channel reload:
anyy channels reload --home ~/.anyy
anyy channels reload --home ~/.anyy --json
Reload 通过本地 socket 把 channel configuration 应用到正在运行的 gateway。如果 gateway 未运行, 先启动它:
anyy gateway start --home ~/.anyy