通过OpenClaw的 openclaw-weixin 通道主动发送微信消息。
本Skill利用OpenClaw Gateway与微信客户端的WebSocket连接,通过发送特定格式的消息包实现主动推送。
OpenClaw Gateway已运行 bash
openclaw gateway status
微信通道已配置
openclaw-weixin 插件已启用目标联系人已存在聊天记录
python
# 使用脚本发送
python3 scripts/send_message.py --to "联系人备注名" --text "消息内容"
# 示例
python3 scripts/send_message.py --to "张三" --text "你好,这是一条测试消息"
python
python3 scripts/send_message.py --to "联系人备注名" --image "/path/to/image.jpg"
python
python3 scripts/send_message.py --to "联系人备注名" --file "/path/to/document.pdf"
限制项说明联系人白名单只能发送给已存在的聊天对象频率限制个人号20条/分钟,超过会被限制内容审核敏感词会被拦截用户确认首次使用需用户显式授权
python
POST http://127.0.0.1:18789/api/wechat/send
Content-Type: application/json
{
"channel": "openclaw-weixin",
"recipient": {
"type": "user", // user | group
"name": "联系人备注名"
},
"message": {
"type": "text", // text | image | file
"content": "消息内容"
}
}
json
{
"success": true,
"messageId": "msg-xxx",
"timestamp": 1701234567890
}
错误码说明解决方案E001未登录微信检查微信通道状态E002联系人不存在确认备注名正确,或先接收对方消息E003频率限制等待60秒后重试E004消息内容违规检查敏感词
scripts/send_message.py - 发送消息主脚本scripts/contact_manager.py - 联系人管理scripts/auth_helper.py - 授权验证references/wechat-api.md - 微信API详细说明references/rate-limits.md - 频率限制详情