基于源码分析(message-channel-normalize.ts)+ 文档 + npm README 综合整理。 经 claude2 review 确认。

重要前提

openclaw message send --channel <id> 支持的 channel 是动态的:

// message-channel-normalize.ts
listDeliverableMessageChannels() = CHANNEL_IDS(内置)+ listRegisteredChannelPluginIds()(外部插件注册后)

外部插件安装并注册后,--channel <plugin-id> 即有效。

四个 channel 支持情况

Channel类型channel IDmessage send 支持
飞书内置 bundledfeishu✅ 直接可用
企业微信外部插件wecom✅ 安装插件后可用,Bot 模式即可主动发
QQ Bot内置插件qqbot✅ 安装插件后可用
微信个人外部插件openclaw-weixin❌ 只支持 reply,不支持主动发

一、飞书(feishu)

内置 channel,无需安装插件。

配置

openclaw channels login --channel feishu
openclaw gateway restart

发消息

# 发给用户(open_id 格式:ou_xxx)
openclaw message send --channel feishu \
  --target ou_xxxxxxxxxxxxxxxxxxxxxxxx \
  --message "你好"
 
# 发给群(chat_id 格式:oc_xxx)
openclaw message send --channel feishu \
  --target oc_xxxxxxxxxxxxxxxxxxxxxxxx \
  --message "群通知"

注意:飞书文档未明确 target 前缀格式。建议先用不带前缀的 ou_xxx/oc_xxx; 若报错,尝试 feishu:user:ou_xxx / feishu:chat:oc_xxx。

获取 ID

  • 用户 open_id:飞书开放平台查询,或在 gateway 日志里找 open_id
  • 群 chat_id:群设置页面,格式 oc_xxx

二、企业微信(wecom)

官方外部插件 @wecom/wecom-openclaw-plugin(Tencent WeCom team 出品)。

安装

# 方式一:CLI 一键安装(推荐)
npx -y @wecom/wecom-openclaw-cli install
 
# 方式二:手动安装
openclaw plugins install @wecom/wecom-openclaw-plugin
openclaw channels add   # 交互式配置 Bot ID + Secret
openclaw gateway restart

主动发消息

插件走 “Bot-first, Agent-fallback” 策略:

  • Bot WebSocket 可用 → 直接走 WS
  • Bot WS 不可用 → 自动 fallback 到 Agent HTTP API

Bot 模式单独配置即可主动发消息,不强制要求 Agent 模式。 (仅 cron jobs 强制要求 Agent outbound path)

# 发给指定用户
openclaw message send --channel wecom \
  --target user:zhangsan \
  --message "你好"
 
# 发给部门(所有成员)
openclaw message send --channel wecom \
  --target party:1 \
  --message "全员通知"
 
# 发给群聊
openclaw message send --channel wecom \
  --target group:wr123abc \
  --message "群消息"

Target 格式

格式目标
user:<id>指定用户
party:<id> / dept:<id>部门(所有成员)
tag:<id>标签组
group:<id> / chat:<id>群聊(两者等价)

user:<id> 中填的是企业微信 userid(英文工号),不是显示名。 namespace 前缀(wecom:、qywx:、wework: 等)会自动去除。

三、QQ Bot(qqbot)

内置插件,需先安装。

安装配置

  1. 在 QQ 开放平台 创建 Bot,获取 AppID + AppSecret
  2. 安装并配置:
openclaw plugins install @openclaw/qqbot
openclaw channels add --channel qqbot --token "AppID:AppSecret"
openclaw gateway restart

发消息

# 私聊(C2C)
openclaw message send --channel qqbot \
  --target qqbot:c2c:USER_OPENID \
  --message "你好"
 
# 群聊
openclaw message send --channel qqbot \
  --target qqbot:group:GROUP_OPENID \
  --message "群消息"
 
# 频道(Guild channel)
openclaw message send --channel qqbot \
  --target qqbot:channel:CHANNEL_ID \
  --message "频道消息"

注意:QQ 平台对 bot 主动发消息有频控,若用户近期未互动可能被拦截。

获取用户 OpenID

在 QQ 群里发 /bot-me 命令,bot 会回复当前用户的 openid。

四、微信个人(openclaw-weixin)

⚠️ 不支持主动发消息。

原因:插件底层 sendMessage API 需要 context_token(从 inbound 消息获取),无法凭空构造,也不在 openclaw message send 的 channel 枚举中。

可用方式:微信用户先发消息给 bot,bot 在微信 channel 内 reply。

相关链接

  • system-prompt-structure — Claude Code system prompt 结构
  • docs/channels/feishu — 飞书 channel 官方文档
  • docs/channels/qqbot — QQ Bot 官方文档
  • docs/channels/wechat — 微信 channel 官方文档
  • docs/cli/message — openclaw message CLI 参考