Install
openclaw skills install huo15-wecom-rules提供企业微信消息和文件发送的标准化操作规则,确保使用企微API优先且执行正确的流程与格式。
openclaw skills install huo15-wecom-rules【版权:青岛火一五信息科技有限公司 账号:huo15】
企业微信全局规则技能 - 整合所有企微相关操作规范
本技能提供企业微信 API 操作的标准化规则,确保所有消息和文件发送行为一致。
发送任何文件给用户时,默认使用企业微信 API 发送。
message 工具 + media 参数)message 工具,action=sendmedia 参数(文件路径)target 参数(用户 ID,格式:user:<userid>)message 参数(附加说明文字)message(action=send, target="user:ZhaoBo", media="/path/to/file.docx", message="文件说明")
当用户说"发送给xxx"或"发个消息给xxx"时,默认使用企业微信 API 主动发送消息。
message 工具,action=sendtarget 参数(用户 ID,格式:user:<userid>)message 参数(消息内容)message(action=send, target="user:ZhaoBo", message="提醒内容")
# ** * ~~ 等符号1. 2. 3.企业微信群聊消息
每次新会话启动时
存入 memory/shared/MEMORY.md,标注来源用户
适用于普通通知、提醒。
# 发送文本消息
message(action=send, target="user:用户ID", message="消息内容")
适用于重要通知、带按钮链接的消息。
特点:
企微API发送:
# 使用企微API发送卡片消息
CORP_ID="wwd00a4d7e69fffdf1"
SECRET="Jg7-sBKn1rhynH_NUgAf-C6dxmNrpUIxLz8qfQ109OQ"
AGENT_ID=1000009
TOKEN=$(curl -s "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CORP_ID&corpsecret=$SECRET" | jq -r '.access_token')
curl -s -X POST "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$TOKEN" \
-H "Content-Type: application/json" \
-d '{
"touser": "用户ID",
"agentid": 1000009,
"msgtype": "textcard",
"textcard": {
"title": "标题",
"description": "描述内容",
"url": "https://example.com/link",
"btntxt": "查看详情"
}
}'
适用于报告、新闻、活动推送,可带封面图片。
特点:
企微API发送:
curl -s -X POST "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$TOKEN" \
-H "Content-Type: application/json" \
-d '{
"touser": "用户ID",
"agentid": 1000009,
"msgtype": "news",
"news": {
"articles": [
{
"title": "文章标题",
"description": "文章描述",
"url": "https://example.com/article",
"picurl": "https://example.com/cover.jpg"
}
]
}
}'
适用于群聊中@多个人的场景。
企微API发送:
curl -s -X POST "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=机器人Key" \
-H "Content-Type: application/json" \
-d '{
"msgtype": "text",
"text": {
"content": "提醒内容",
"mentioned_list": ["userid1", "userid2", "userid3"]
}
}'
| 配置项 | 值 |
|---|---|
| 企业ID | wwd00a4d7e69fffdf1 |
| AgentId | 1000009 |
| Secret | Jg7-sBKn1rhynH_NUgAf-C6dxmNrpUIxLz8qfQ109OQ |
| 机器人Webhook | 30e68984-0562-4d13-b3cc-16d0df7a382a |
# 获取Access Token
curl -s "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CORP_ID&corpsecret=$SECRET"
# 发送应用消息(私聊)
curl -s -X POST "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$TOKEN" \
-H "Content-Type: application/json" \
-d '{"touser": "用户ID", "agentid": 1000009, "msgtype": "text", "text": {"content": "消息内容"}}'
# 发送群机器人消息
curl -s -X POST "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=机器人Key" \
-H "Content-Type: application/json" \
-d '{"msgtype": "text", "text": {"content": "消息内容"}}'
/new 或开启新会话时# 获取 Access Token
CORP_ID="wwd00a4d7e69fffdf1"
SECRET="Jg7-sBKn1rhynH_NUgAf-C6dxmNrpUIxLz8qfQ109OQ"
TOKEN=$(curl -s "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CORP_ID&corpsecret=$SECRET" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
# 获取用户信息
curl -s "https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=$TOKEN&userid=用户ID"
获取后存入 memory/shared/MEMORY.md,标注来源用户:
## {用户姓名}存入
- userid: xxx
- 姓名: xxx
- 性别: xxx
根据获取到的性别动态更新称呼:
每次新会话启动时(输入 /new 或开启新会话)
chat_id(即 userid)memory/shared/MEMORY.md,标注来源## {用户姓名}存入
- userid: xxx
- 姓名: xxx
- 性别: xxx
chat_id 确定用户身份发送文件时 → 使用企微 API 上传并发送文件本身,不要发临时下载链接或路径