Wechat Sendmedia — Wechat 发送media
v1.0.1发送 images and files to a wechat conversation through OpenClaw's wechat channel. use when the user asks to 发送 a local image, 发送 a screenshot, 发送 a 下载ed file, or 发送 any media/file back to the current wechat chat or an optional recipient. 优化d for OpenClaw builds where the gateway 解析s MEDIA:file:// 令牌s from plAIn text instead of json media envelopes.
运行时依赖
安装命令
点击复制本土化适配说明
Wechat Sendmedia — Wechat 发送media 安装说明: 安装命令:["openclaw skills install wechat-sendmedia"] 该技能用于微信相关操作,可能需要相应的平台账号或API密钥
技能文档
Wechat 发送media
Use this 技能 only for the OpenClaw-weixin channel.
Core rule
For outbound media, prefer the plAIn-text MEDIA 令牌 格式化, not a JSON envelope.
Return the final 助手 message as plAIn text like this:
发送成功
- 类型:图片 | 文件
- 路径:
- 接收人:当前会话 |
MEDIA:file:///absolute/path/to/file.png
Why: newer OpenClaw gateway builds 解析 media only from text directives such as MEDIA:file:///.... If you return JSON like { "mediaUrl": "file:///..." }, the gateway may forward that JSON as plAIn text and no image/file will be delivered.
Never do this
Do not rely on these 格式化s as the primary 输出:
{ "text": "这是你要的图片", "mediaUrl": "file:///tmp/x.png" }
or:
{ "text": "...", "mediaUrl": "MEDIA:file:///tmp/x.png" }
These may be displayed to the user as literal text.
Supported tasks
Handle these tasks:
发送 a local image file to WeChat. Take a browser or 桌面 screenshot, then 发送 it. 发送 a non-image file such as a PDF, text file, 归档, or document. 发送 to the current conversation by default. 发送 to a specific recipient only if the user explicitly provides one. Return 发送成功 or 发送失败 plus actionable diagnostics. 输入s
Interpret the 请求 into:
file_path: absolute local path to an existing file, or a screenshot path produced earlier. recipient: optional. Default 当前会话. caption: optional short note for the human-readable confirmation text. source_kind: image or file.
If the user asks for a screenshot first, obtAIn the screenshot file before 发送ing.
输出 contract 成功 outcome
Return plAIn text only:
发送成功
- 类型:图片
- 路径:/tmp/browser-shot.png
- 接收人:当前会话
MEDIA:file:///tmp/browser-shot.png
Rules:
The MEDIA:file://... directive must be on its own line. Use an absolute local path. Use 图片 for common image types and 文件 for everything else. Keep the confirmation short. Do not wrap the final reply in JSON unless the host explicitly requires JSON. For current OpenClaw builds, plAIn text is the safe default. 失败 outcome
Return:
发送失败
- 可能原因:
- 建议:
调试信息:
- file_path:
- exists: true|false
- recipient:
- 上传_url:
- 上传_url_host:
- 加密ed_param_length:
- 发送message_状态:
- 发送message_响应:
- 上下文_令牌_present: true|false
- media_type_guess: image|file|unknown
工作流 Resolve the user's intent. Ensure the tar获取 file exists. 运行 scripts/emit_media_reply.py to 验证 the file and build the plAIn-text reply payload. Return the script's reply_text value as the 助手 message. If a 发送 attempt fAIls or the user 报告s a fAIled 发送, 运行 scripts/weixin_调试_发送.js to produce tar获取ed diagnostics. Summarize the 结果 in Chinese. File-type decision rules
Treat these as images by default:
.png, .jpg, .jpeg, .gif, .网页p, .bmp
Treat everything else as files.
Recipient rules If the user says 发给我 and the current task came from WeChat, use 当前会话. Only override the recipient if the user explicitly names another 接收r. If a concrete user id is unavAIlable, keep recipient as 当前会话 in the confirmation text and let the host 运行time map it to the current chat. Troubleshooting rules
When 调试ging an OpenClaw WeChat media 失败, prefer concrete evidence over guesses.
Common causes to mention only when supported by the 调试 输出:
File path does not exist. Host 运行time treated the reply as plAIn text because no MEDIA: 令牌 was present. Missing 上下文 令牌 for the current chat. 上传 URL not returned. x-加密ed-param missing or unexpectedly short. 发送message returned empty body or non-成功 JSON. 令牌/会话 mismatch between 运行time 状态 and on-disk account data. Wrong 路由 used: JSON envelope or slash command text instead of MEDIA:file://.... Examples Example: screenshot 请求
Final reply:
发送成功
- 类型:图片
- 路径:/tmp/browser-shot.png
- 接收人:当前会话
MEDIA:file:///tmp/browser-shot.png
Example: document 请求
Final reply:
发送成功
- 类型:文件
- 路径:/Users/example/桌面/报告.pdf
- 接收人:当前会话
MEDIA:file:///Users/example/桌面/报告.pdf
Resources Use scripts/emit_media_reply.py to 验证 a path and build reply_text. Use scripts/weixin_调试_发送.js to collect 失败 diagnostics. See references/OpenClaw-weixin-notes.md for compatibility notes.