openclaw channels

管理聊天频道账号及其在 Gateway 上的运行状态。

相关文档:

常用命令

openclaw channels list
openclaw channels status
openclaw channels capabilities
openclaw channels capabilities --channel discord --target channel:123
openclaw channels resolve --channel slack "#general" "@jane"
openclaw channels logs --channel all

添加 / 移除账号

openclaw channels add --channel telegram --token <bot-token>
openclaw channels remove --channel telegram --delete

提示:openclaw channels add --help 可以查看各频道的特定参数(token、app token、signal-cli 路径等)。

不带参数运行 openclaw channels add 时,交互式向导会提示:

  • 为选定频道输入账号 ID
  • 可选的账号显示名称
  • 是否现在将配置的频道账号绑定到 Agent?

如果确认立即绑定,向导会询问每个已配置的频道账号应归属哪个 Agent,并写入带账号作用域的路由绑定。

你也可以稍后通过 openclaw agents bindingsopenclaw agents bindopenclaw agents unbind 管理相同的路由规则(参见 agents)。

当你向一个仍在使用单账号顶层配置(尚无 channels.<channel>.accounts 条目)的频道添加非默认账号时,OpenClaw 会将带账号作用域的单账号顶层值移入 channels.<channel>.accounts.default,然后写入新账号。这样在切换到多账号结构的同时保留了原有账号的行为。

路由行为保持一致:

  • 现有的频道级绑定(不带 accountId)继续匹配默认账号。
  • 非交互模式下 channels add 不会自动创建或改写绑定。
  • 交互式设置可以选择添加带账号作用域的绑定。

如果你的配置处于混合状态(有命名账号、缺少 default、且顶层单账号值仍然存在),运行 openclaw doctor --fix 把带账号作用域的值移入 accounts.default

登录 / 登出(交互式)

openclaw channels login --channel whatsapp
openclaw channels logout --channel whatsapp

故障排查

  • 运行 openclaw status --deep 做全面探测。
  • 使用 openclaw doctor 获取引导式修复建议。
  • openclaw channels list 打印 Claude: HTTP 403 ... user:profile -> 用量快照需要 user:profile 权限。可以用 --no-usage,或提供 claude.ai 会话密钥(CLAUDE_WEB_SESSION_KEY / CLAUDE_WEB_COOKIE),或通过 Claude Code CLI 重新认证。
  • openclaw channels status 在 Gateway 不可达时回退到仅配置的摘要。如果某个支持的频道凭据通过 SecretRef 配置但在当前命令路径中不可用,会将该账号报告为已配置但带降级说明,而不是显示为未配置。

能力探测

获取提供商的能力提示(可用时包含 intent/scope)以及静态功能支持:

openclaw channels capabilities
openclaw channels capabilities --channel discord --target channel:123

说明:

  • --channel 是可选的;省略则列出所有频道(包括扩展)。
  • --target 接受 channel:<id> 或纯数字频道 ID,仅对 Discord 有效。
  • 探测因提供商而异:Discord 的 intent + 可选频道权限;Slack 的 bot + user scope;Telegram 的 bot 标志 + webhook;Signal 的守护进程版本;MS Teams 的 app token + Graph 角色/scope(已知的会标注)。没有探测能力的频道报告 Probe: unavailable

名称解析为 ID

通过提供商目录将频道/用户名称解析为 ID:

openclaw channels resolve --channel slack "#general" "@jane"
openclaw channels resolve --channel discord "My Server/#support" "@someone"
openclaw channels resolve --channel matrix "Project Room"

说明:

  • 使用 --kind user|group|auto 强制指定目标类型。
  • 当多个条目同名时,优先选择活跃的匹配项。
  • channels resolve 是只读操作。如果选中的账号通过 SecretRef 配置但该凭据在当前命令路径中不可用,命令会返回降级的未解析结果并附带说明,而不是中止整个运行。