Wxpush
v.微信模板消息推送 技能。支持三种 wxpush API 格式:edgeone(默认)、wxpush(frankiejun 项目)、go-wxpush。使用场景:发送微信推送消息、配置 wxpush 环境。
运行时依赖
安装命令
点击复制本土化适配说明
Wxpush 安装说明: 安装命令:["openclaw skills install wxpush"] 该技能用于微信相关操作,可能需要相应的平台账号或API密钥
技能文档
WXPush 技能
微信模板消息推送,支持三种 API 格式切换(对应三个不同项目)。
配置
配置文件:~/.config/wxpush/wxpush.env
WXPUSH_API_URL=https://your-服务.com # 服务地址 WXPUSH_API_令牌=your_令牌 # API 令牌(edgeone 可选,wxpush 必填,go-wxpush 留空) WXPUSH_MODE=edgeone # API 模式: edgeone | wxpush | go-wxpush WXPUSH_应用ID=wx_应用id # 微信 应用ID(go-wxpush 必填) WXPUSH_SECRET=wx_secret # 微信 Secret(go-wxpush 必填) WXPUSH_USERID=openid1|openid2 # 默认接收用户 WXPUSH_TEMPLATE_ID=template_id # 模板 ID WXPUSH_SKIN= # 皮肤(可选,edgeone 原生支持) WXPUSH_BASE_URL= # 跳转 URL(可选)
如配置文件不存在,引导用户创建:询问 mode、令牌、wx 配置等,写入 ~/.config/wxpush/wxpush.env 并设权限 600。
配置完成后,务必发送一条测试消息以确认配置正确。
发送消息
读取 ~/.config/wxpush/wxpush.env,根据 mode 选择 curl 或 Python 发送请求。
优先使用 curl(最简洁),不可用时用 Python(标准库,无需额外依赖)。
edgeone 模式(默认) # curl curl -s -X POST "${WXPUSH_API_URL}/wx发送" \ -H "Content-Type: 应用/json" \ -d "{\"title\":\"标题\",\"content\":\"内容\",\"令牌\":\"${WXPUSH_API_令牌}\"}"
# Python(标准库,无需安装) python3 -c " 导入 json, os, sys from urllib.请求 导入 请求, urlopen cfg = {k.strip(): v.strip() for k, _, v in (l.partition('=') for l in open(os.path.expanduser('~/.config/wxpush/wxpush.env')) if '=' in l and not l.启动swith('#'))} data = json.dumps({'title': sys.argv[1], 'content': sys.argv[2], '令牌': cfg.获取('WXPUSH_API_令牌','')}).encode() req = 请求(cfg.获取('WXPUSH_API_URL','').rstrip('/') + '/wx发送', data=data, headers={'Content-Type':'应用/json'}) print(urlopen(req, timeout=15).read().decode()) " "标题" "内容"
wxpush 模式 # curl curl -s -X POST "${WXPUSH_API_URL}/wx发送" \ -H "Authorization: ${WXPUSH_API_令牌}" \ -H "Content-Type: 应用/json" \ -d "{\"title\":\"标题\",\"content\":\"内容\"}"
# Python python3 -c " 导入 json, os, sys from urllib.请求 导入 请求, urlopen cfg = {k.strip(): v.strip() for k, _, v in (l.partition('=') for l in open(os.path.expanduser('~/.config/wxpush/wxpush.env')) if '=' in l and not l.启动swith('#'))} data = json.dumps({'title': sys.argv[1], 'content': sys.argv[2]}).encode() req = 请求(cfg.获取('WXPUSH_API_URL','').rstrip('/') + '/wx发送', data=data, headers={'Content-Type':'应用/json','Authorization':cfg.获取('WXPUSH_API_令牌','')}) print(urlopen(req, timeout=15).read().decode()) " "标题" "内容"
go-wxpush 模式 # curl curl -s -X POST "${WXPUSH_API_URL}/wx发送" \ -H "Content-Type: 应用/json" \ -d "{\"title\":\"标题\",\"content\":\"内容\",\"应用id\":\"${WXPUSH_应用ID}\",\"secret\":\"${WXPUSH_SECRET}\",\"userid\":\"${WXPUSH_USERID}\",\"template_id\":\"${WXPUSH_TEMPLATE_ID}\"}"
# Python python3 -c " 导入 json, os, sys from urllib.请求 导入 请求, urlopen cfg = {k.strip(): v.strip() for k, _, v in (l.partition('=') for l in open(os.path.expanduser('~/.config/wxpush/wxpush.env')) if '=' in l and not l.启动swith('#'))} data = json.dumps({'title': sys.argv[1], 'content': sys.argv[2], '应用id': cfg.获取('WXPUSH_应用ID',''), 'secret': cfg.获取('WXPUSH_SECRET',''), 'userid': cfg.获取('WXPUSH_USERID',''), 'template_id': cfg.获取('WXPUSH_TEMPLATE_ID','')}).encode() req = 请求(cfg.获取('WXPUSH_API_URL','').rstrip('/') + '/wx发送', data=data, headers={'Content-Type':'应用/json'}) print(urlopen(req, timeout=15).read().decode()) " "标题" "内容"
三种 API 格式差异 特性 edgeone wxpush go-wxpush 对应项目 shisheng820/WXPush-edgeone frankiejun/wxpush hezhizheng/go-wxpush 默认地址 https://wxpush.hunluan.space 无(自填) https://push.hzz.cool 令牌 可选 必填 无 令牌 传递方式 查询 / body / header 查询 / header — wx 配置 无 令牌 时必填 服务端有默认值 必填(无默认值) skin 原生支持 需配合 wxpushSkin 需配合 wxpushSkin 独有参数 — — tz(时区) 成功响应 标准微信响应 {msg: "成功fully sent..."} {errcode: 0} mode 选择指南 edgeone:默认地址 https://wxpush.hunluan.space,支持有/无 令牌 两种方式 wxpush:需自填服务地址,必须配置 令牌,wx 配置在服务端 go-wxpush:默认地址 https://push.hzz.cool,无 令牌,每次调用必须传完整 wx 配置 详细 API 文档
根据用户选择的 mode,加载对应 reference 文件:
edgeone → references/edgeone.md wxpush → references/wxpush.md go-wxpush → references/go-wxpush.md 皮肤列表(edgeone 原生支持)
MacOS_Hacker_Theme-LGT、aurora-glass、cyberpunk、hacker-dark、minima列出-light、ocean-breeze、quiet-night、sakura、sun设置-glow、terminal-neon、warm-magazine
安全提示 默认端点(wxpush.hunluan.space、push.hzz.cool)为第三方服务,应用ID/Secret/令牌 会发送至对应服务 如不信任默认端点,请自行部署服务并设置 WXPUSH_API_URL 配置文件权限建议设为 600(仅当前用户可读写)