tags:
OpenClaw 企业微信插件(@wecom/wecom-openclaw-plugin)由腾讯企业微信团队官方维护,支持两种模式:
| 模式 | 连接方式 | 消息格式 | 适用场景 |
|---|---|---|---|
| Bot 模式(智能机器人) | WebSocket 长连接 | JSON | 快速接入,流式回复 |
| Agent 模式(自建应用) | HTTP Webhook 回调 | XML 加密 | 企业应用,API 驱动 |
本文档聚焦 Bot 模式(WebSocket),这也是最常用的方式。
# 一键安装(推荐)
npx -y @wecom/wecom-openclaw-cli install
# 强制重装
npx -y @wecom/wecom-openclaw-cli install --force
安装后插件默认处于 disabled 状态,需两步启用:
# 1. 将插件加入白名单
openclaw config set plugins.allow '["deepseek","searxng","memory-core","wecom-openclaw-plugin"]'
# 2. 重启 gateway
openclaw daemon restart
验证:
openclaw plugins list | grep wecom应显示enabled
openclaw config set channels.wecom.botId "你的BotID"
openclaw config set channels.wecom.secret "你的Secret"
openclaw config set channels.wecom.enabled true
openclaw daemon restart
Skills 依赖 wecom_mcp MCP 工具,需确保在 tools.alsoAllow 中:
openclaw config set tools.alsoAllow '["wecom_mcp"]'
openclaw status
# 应看到:WeCom | ON | OK | configured
| 配置项 | 说明 | 默认值 |
|---|---|---|
channels.wecom.enabled |
启用通道 | false |
channels.wecom.botId |
机器人 Bot ID | — |
channels.wecom.secret |
机器人 Secret | — |
channels.wecom.connectionMode |
连接模式 | websocket |
channels.wecom.websocketUrl |
WebSocket 端点 | wss://openws.work.weixin.qq.com |
channels.wecom.sendThinkingMessage |
发送"思考中"占位 | true |
| 配置项 | 说明 | 可选值 | 默认值 |
|---|---|---|---|
channels.wecom.dmPolicy |
私聊策略 | pairing/open/allowlist/disabled |
open |
channels.wecom.groupPolicy |
群聊策略 | open/allowlist/disabled |
open |
channels.wecom.allowFrom |
私聊白名单 | userid 数组 | [] |
channels.wecom.groupAllowFrom |
群聊白名单 | chatid 数组 | [] |
所有 Skill 通过
wecom_mcpMCP 工具调用,格式:wecom_mcp call <品类> <接口> '<JSON入参>'
触发词:查同事、找某人、通讯录
| 接口 | 用途 |
|---|---|
get_userlist |
获取可见范围内全部成员(userid、姓名、别名) |
wecom_mcp call contact get_userlist '{}'
触发词:查看消息、看聊天记录、发消息、最近有什么消息
| 接口 | 用途 | chat_type |
|---|---|---|
get_msg_chat_list |
按时间范围查会话列表 | — |
get_message |
拉取会话消息(7天内) | 1=单聊 2=群聊 |
get_msg_media |
下载图片/文件/语音/视频 | — |
send_message |
发送文本消息 | 1=单聊 2=群聊 |
# 获取会话列表
wecom_mcp call msg get_msg_chat_list '{"begin_time":"2026-07-01 00:00:00","end_time":"2026-07-04 23:59:59"}'
# 拉取群消息
wecom_mcp call msg get_message '{"chat_type":2,"chatid":"群ID","begin_time":"2026-07-01 00:00:00","end_time":"2026-07-04 23:59:59"}'
# 发送消息
wecom_mcp call msg send_message '{"chat_type":2,"chatid":"群ID","msgtype":"text","text":{"content":"你好"}}'
限制:消息拉取仅支持最近 7 天,时间格式
YYYY-MM-DD HH:mm:ss
触发词:企业微信文档、创建文档、写个文档、改写文档
| 接口 | 用途 |
|---|---|
create_doc |
新建空白文档 |
get_doc_content |
以 Markdown 读取文档内容 |
edit_doc_content |
用 Markdown 覆写文档内容 |
wecom_mcp call doc create_doc '{"doc_name":"会议纪要"}'
wecom_mcp call doc get_doc_content '{"docid":"xxx"}'
wecom_mcp call doc edit_doc_content '{"docid":"xxx","content":"# 新内容"}'
支持通过
docid或文档 URL 定位。URL 格式:https://doc.weixin.qq.com/doc/xxx
触发词:企业微信表格、在线表格、Excel
| 接口 | 用途 |
|---|---|
create_doc |
新建在线表格(doc_type=3) |
get_doc_content |
读取为 Markdown |
sheet_get_info |
获取子表列表和基础信息 |
wecom_mcp call doc create_doc '{"doc_type":3,"doc_name":"数据统计"}'
URL 格式:
https://doc.weixin.qq.com/sheet/xxx
触发词:智能表格、smartsheet
| 接口 | 用途 |
|---|---|
create_doc |
新建智能表格(doc_type=10) |
smartsheet_get_sheet |
查询子表 |
smartsheet_add_sheet |
添加子表 |
smartsheet_get_fields |
查询字段 |
smartsheet_add_fields |
添加字段 |
smartsheet_get_records |
查询记录 |
wecom_mcp call doc create_doc '{"doc_type":10,"doc_name":"项目管理"}'
URL 格式:
https://doc.weixin.qq.com/smartsheet/xxx
触发词:智能文档、智能主页
| 接口 | 用途 |
|---|---|
smartpage_create |
将 Markdown 发布为智能文档 |
smartpage_export_task |
提交导出任务(异步) |
smartpage_get_export_result |
查询导出结果 |
wecom_mcp call doc smartpage_create '{"doc_name":"周报","content":"# 本周工作总结"}'
URL 格式:
https://doc.weixin.qq.com/smartpage/xxx
触发词:创建会议、预约会议、查看会议、取消会议
| 接口 | 用途 |
|---|---|
create_meeting |
创建预约会议 |
list_user_meetings |
查询会议列表(±30天) |
get_meeting_info |
获取会议详情 |
cancel_meeting |
取消会议 |
set_invite_meeting_members |
更新参与人 |
wecom_mcp call meeting create_meeting '{"title":"项目评审","start_time":1719993600,"end_time":1719997200}'
触发词:创建日程、安排日程、查看日程、闲忙查询
| 接口 | 用途 |
|---|---|
get_schedule_list_by_range |
查询日程列表 |
get_schedule_detail |
获取日程详情 |
create_schedule |
创建日程 |
update_schedule |
修改日程 |
cancel_schedule |
取消日程 |
check_availability |
查询成员闲忙状态 |
wecom_mcp call schedule create_schedule '{"subject":"团队周会","start_time":"2026-07-05 10:00:00","end_time":"2026-07-05 11:00:00"}'
触发词:创建待办、分派任务、标记完成、查看待办
| 接口 | 用途 |
|---|---|
search_todo_userid |
按姓名搜索 userid |
create_todo |
创建待办 |
update_todo |
更新待办内容/时间 |
change_todo_user_status |
更改用户状态(接受/拒绝/完成) |
get_todo_list |
获取待办列表 |
get_todo_detail |
批量获取待办详情 |
delete_todo |
删除待办 |
wecom_mcp call todo create_todo '{"content":"完成Q3报告","follower":[{"userid":"zhangsan"}]}'
触发词:发送文件、分享图片、传个文件
在回复中使用 MEDIA: 指令发送本地文件:
MEDIA:/path/to/image.png
MEDIA:/path/to/document.pdf
大小限制:图片 10MB、视频 10MB、语音 2MB(AMR)、文件 20MB。超限自动降级。
触发词:发通知、投票、方案选择、多维度选择
| 卡片类型 | 用途 |
|---|---|
text_notice |
文本通知 |
news_notice |
图文通知 |
button_interaction |
按钮交互 |
vote_interaction |
投票表决 |
multiple_interaction |
多维度选择 |
# 投票
wecom_mcp call msg send_template_card '{"chat_type":2,"chatid":"群ID","template_card_type":"vote_interaction",...}'
用途:首次使用前检查 wecom_mcp 是否已加入工具白名单。其他 Skill 会自动触发此检查。
| URL 模式 | 品类 | 对应 Skill |
|---|---|---|
doc.weixin.qq.com/doc/* |
普通文档 | wecom-doc |
doc.weixin.qq.com/sheet/* |
在线表格 | wecom-sheet |
doc.weixin.qq.com/smartsheet/* |
智能表格 | wecom-smartsheet |
doc.weixin.qq.com/smartpage/* |
智能文档 | wecom-smartpage |
把机器人加入群聊即可。群策略默认 open,所有群都能 @机器人 对话。
# 查看/设置群策略
openclaw config get channels.wecom.groupPolicy
openclaw config set channels.wecom.groupPolicy open
通过 wecom-msg Skill 的 get_message(chat_type=2)拉取 7 天内的群消息:
# 先获取会话列表找到群 chatid
wecom_mcp call msg get_msg_chat_list '{"begin_time":"2026-07-01 00:00:00","end_time":"2026-07-04 23:59:59"}'
# 拉取该群消息
wecom_mcp call msg get_message '{"chat_type":2,"chatid":"群的chatid","begin_time":"2026-07-01 00:00:00","end_time":"2026-07-04 23:59:59"}'
get_msg_chat_list → 查找目标群的 chatidget_message(chat_type=2) → 拉取消息wecom-contact get_userlist → userid 转姓名get_msg_media 下载openclaw status # 快速状态
openclaw plugins list # 插件列表
openclaw config get channels # 通道配置
openclaw doctor # 诊断修复
openclaw logs --follow # 实时日志
openclaw logs --follow | grep wecom # 只看 WeCom 相关
openclaw plugins update wecom-openclaw-plugin
npx -y @wecom/wecom-openclaw-cli install --force
openclaw daemon restart
按以下顺序排查:
openclaw plugins list — 确认 wecom-openclaw-plugin 状态为 enabledopenclaw config get channels.wecom — 确认 botId/secret/enabled 已配置openclaw status — 确认 WeCom 通道 State=OKopenclaw logs --follow — 查看实时日志常见根因:插件 installed 但 disabled,需要两步:加入
plugins.allow+ 重启 gateway。
检查 tools.alsoAllow 是否包含 wecom_mcp:
openclaw config get tools.alsoAllow
# 应包含 "wecom_mcp"
YYYY-MM-DD HH:mm:ss所有 Skill 需先通过 wecom-preflight 检查。确保 tools.allow 或 tools.alsoAllow 中包含 wecom_mcp。
# 白名单模式(仅指定群可用)
openclaw config set channels.wecom.groupPolicy allowlist
openclaw config set channels.wecom.groupAllowFrom '["群chatid1","群chatid2"]'