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
  • 為這些帳號輸入選擇性的顯示名稱
  • Bind configured channel accounts to agents now?

確認綁定後,精靈會詢問每個已設定的頻道帳號應歸屬哪個 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 session key(CLAUDE_WEB_SESSION_KEY / CLAUDE_WEB_COOKIE),或透過 Claude Code CLI 重新授權。
  • 當 Gateway 無法連線時,openclaw channels status 會退回至僅設定的摘要。如果支援的頻道憑證是透過 SecretRef 設定但在目前指令路徑中不可用,它會將該帳號報告為已設定但附帶降級備註,而非顯示為未設定。

能力探測

取得供應商能力提示(可用時包括 intents/scopes)加上靜態功能支援:

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

注意事項:

  • --channel 為選用;省略時會列出所有頻道(含擴充功能)。
  • --target 接受 channel:<id> 或原始數字頻道 id,僅適用於 Discord。
  • 探測因供應商而異:Discord intents + 選用的頻道權限;Slack bot + user scopes;Telegram bot 旗標 + webhook;Signal daemon 版本;MS Teams app token + Graph 角色/scopes(已知處有標註)。沒有探測的頻道會報告 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 設定但該憑證在目前指令路徑中不可用,指令會回傳附帶備註的降級未解析結果,而非中止整個執行。