openclaw里面如何添加channel

张开发
2026/4/3 19:59:58 15 分钟阅读
openclaw里面如何添加channel
在 OpenClaw 中添加Channel消息通道 / 渠道核心是通过CLI 命令或直接编辑配置文件将 Telegram、Discord、飞书、WhatsApp 等 IM 平台接入网关Gateway并绑定到 Agent。以下是完整、可直接操作的步骤。一、核心概念Channel外部消息入口Telegram、Discord、飞书、QQ 等Gateway消息路由转发中心负责 Channel ↔ Agent 通信Binding将 Channel 账户绑定到指定 Agent决定消息由谁处理二、方法 1交互式添加推荐最简单自动引导完成所有步骤bash运行# 启动交互式 Channel 添加向导 openclaw channels add步骤选择平台telegram/discord/feishu/whatsapp/qqbot输入对应凭证Token/AppID/AppSecret 等设置账户名如main选择是否立即绑定到 Agent推荐是选择要绑定的 Agent如main/write/dev完成后自动写入配置三、方法 2命令行一键添加非交互1. Telegrambash运行openclaw channels add \ --channel telegram \ --account main \ --token 123456:ABCdefGhIJKlmNoPQRstUvWxYz123456 # 从 BotFather 获取2. Discordbash运行openclaw channels add \ --channel discord \ --account main \ --botToken TOKEN \ --applicationId 1234567893. 飞书 (Feishu)bash运行openclaw channels add \ --channel feishu \ --account main \ --appId cli_xxxxxx \ --appSecret xxxxxx \ --verificationToken xxxxxx4. QQ 频道bash运行# 先安装插件 openclaw plugins install sliverp/qqbotlatest openclaw channels add \ --channel qqbot \ --account main \ --token AppID:AppSecret四、方法 3手动编辑配置文件openclaw.json路径~/.openclaw/openclaw.json完整多 Channel 示例json{ channels: { telegram: { enabled: true, defaultAccount: main, dmPolicy: allowlist, // allowlist / open / pairing / disabled groupPolicy: allowlist, allowFrom: [tg:123456789], // 允许的用户ID accounts: { main: { token: 123456:ABCdef... } } }, feishu: { enabled: true, defaultAccount: work, dmPolicy: allowlist, accounts: { work: { appId: cli_xxxxxx, appSecret: xxxxxx, verificationToken: xxxxxx } } }, discord: { enabled: true, defaultAccount: server, dmPolicy: allowlist, accounts: { server: { botToken: xxxxxx, applicationId: 123456789 } } } } }五、关键配置说明enabled:true启用该 ChanneldefaultAccount: 默认使用的账户dmPolicy:allowlist: 仅allowFrom列表内用户可对话pairing: 需要配对码验证安全open: 任何人可聊不推荐allowFrom: 白名单用户 ID格式依平台六、绑定 Channel → Agent消息路由1. 命令行绑定bash运行# 将 Telegram main 账户 绑定到 Agent main openclaw agents bind \ --agent main \ --channel telegram \ --account main2. 查看绑定bash运行openclaw agents bindings七、重启网关生效bash运行openclaw gateway restart八、登录 / 验证如 WhatsApp部分渠道需扫码登录bash运行openclaw channels login --channel whatsapp # 扫描二维码完成授权九、测试发送消息bash运行openclaw message send \ --channel telegram \ --target your_username \ --message Hello from OpenClaw!十、常用命令速查openclaw channels list— 查看所有 Channelopenclaw channels remove --channel telegram --account main --delete— 删除openclaw channels capabilities --channel telegram— 查看能力openclaw gateway logs— 查看日志排错总结新手用openclaw channels add交互式添加批量 / 脚本用channels add --channel ... --token ...高级 / 多账户直接编辑channels配置块必做添加后绑定 Agent重启网关

更多文章