Skip to content
Skills Library
Personal productivity · Tool integration

wekeapi-message

/wekeapi-message

wekeapi CLI message 模块:微信消息发送(文本/图片/视频/文件/语音/链接/小程序/Emoji/名片/AppMsg)、消息转发与撤回、下载收到的媒体(图片/视频/语音/文件/Emoji/CDN),以及通过 wekeapi-msg-sync 查询消息记录。当用户要求发微信消息、群发、转发消息、@群成员、撤回消息、查询聊天记录或下载消息里的附件时使用。

Licence
MIT
Last repository change
13.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

wekeapi CLI message 模块:微信消息发送(文本/图片/视频/文件/语音/链接/小程序/Emoji/名片/AppMsg)、消息转发与撤回、下载收到的媒体(图片/视频/语音/文件/Emoji/CDN),以及通过 wekeapi-msg-sync 查询消息记录。当用户要求发微信消息、群发、转发消息、@群成员、撤回消息、查询聊天记录或下载消息里的附件时使用。

Original author description

wekeapi CLI message 模块:微信消息发送(文本/图片/视频/文件/语音/链接/小程序/Emoji/名片/AppMsg)、消息转发与撤回、下载收到的媒体(图片/视频/语音/文件/Emoji/CDN),以及通过 wekeapi-msg-sync 查询消息记录。当用户要求发微信消息、群发、转发消息、@群成员、撤回消息、查询聊天记录或下载消息里的附件时使用。

How it works

  1. 前置
  2. 发送
  3. 转发(同一内容发多人:先 send- 发第一人,再 forward-,效率更高)
  4. 下载(均支持 --out <路径> 直接保存文件)
  5. 示例
  6. 发送后自动落库(自己发的消息也会记录)
  7. 注意
Original SKILL.md headings · 98 lines, 657 words
SKILL.md preview
---
name: wekeapi-message
description: wekeapi CLI message 模块:微信消息发送(文本/图片/视频/文件/语音/链接/小程序/Emoji/名片/AppMsg)、消息转发与撤回、下载收到的媒体(图片/视频/语音/文件/Emoji/CDN),以及通过 wekeapi-msg-sync 查询消息记录。当用户要求发微信消息、群发、转发消息、@群成员、撤回消息、查询聊天记录或下载消息里的附件时使用。
---

# message 消息

## 前置

- 二进制复用 wekeapi-core skill 的 `assets/bin/`(相对该 skill 目录解析,不要写死 skills 根目录),按 OS/架构选择(Windows x64: `wekeapi-windows-amd64.exe` / Windows ARM64: `wekeapi-windows-arm64.exe` / Linux x64: `wekeapi-linux-amd64` / Linux ARM64: `wekeapi-linux-arm64` / macOS Intel: `wekeapi-darwin-amd64` / macOS ARM: `wekeapi-darwin-arm64`),下文以 `$WEKEAPI` 代指;`PATH` 中已有 `wekeapi` 时优先用 `wekeapi`,定位与兜底见 wekeapi-core「二进制」。
- 调用需 token(访问凭证,全部账号共用,`init` 保存后可免传);**多账号时用 `--app-id` 指定本次操作的账号**(取值见 `wekeapi account list`),省略时用默认账号;stdout 恒为 JSON;退出码 0 成功 / 1 API 业务错误 / 2 本地错误。
- `--to-wxid` 好友、群通用(群 ID 形如 `12345@chatroom`)。其余全局约定见 wekeapi-core skill。
- 用户给的是微信号/昵称/备注而非 wxid 时,先用 `$WEKEAPI data contacts --keyword <关键词>` 解析(`data.contacts[].id` 即 wxid),查不到再调远端接口;**不要再用 sqlite3 查本地数据库**。
- **消息由 wekeapi-msg-sync 统一存储**:服务接收消息回调并落库;CLI 发送/转发成功后也会把消息上报落库。查询聊天记录用 `$WEKEAPI data messages`(`--conversation-id S:<wxid>|R:<roomid>`、`--keyword`、`--start-time`/`--end-time`、`--page`/`--limit`),返回 `data.messages[]`(含 `new_msg_id`/`from`/`to`/`room_id`/`content`/`create_time`/`revoked`),`from` 等于自己即本人发出。

## 发送

> **发送类接口(`send-*` / `forward-*`)必须串行执行,两次调用之间间隔 3 秒以上**(硬性要求,见「注意」)。

| 命令 | 说明 | 参数 |
|---|---|---|
| `message send-text` | 发文本 | **`--to-wxid`**、**`--content`**;`--ats` 群@成员(逗号分隔,@全部填 `all`,内容需含"@昵称") |
| `message send-voice` | 发语音(wav/SILK,≤60 秒) | **`--to-wxid`**、**`--file`/`--url`** |
| `message send-image` | 发图片(≤20MB,jpg/png/bmp/webp/tiff) | **`--to-wxid`**、**`--file`/`--url`** |
| `message send-video` | 发视频(≤200MB) | **`--to-wxid`**、**`--file`/`--url`** |
| `message send-file` | 发文件(≤200MB) | **`--to-wxid`**、**`--file`/`--url`**、**`--file-name`** 含扩展名 |
| `message send-link` | 发链接 | **`--to-wxid`**、**`--title`**、**`--link-url`**、**`--file`/`--url`** 缩略图(≤5MB);`--desc` |
| `message send-miniapp` | 发小程序(先发给自己取接收消息的 xml) | **`--to-wxid`**、**`--xml`/`--xml-file`** |
| `message send-emoji` | 发 Emoji | **`--to-wxid`**、**`--emoji-md5`**、**`--emoji-size`** |
| `message send-card` | 发名片 | **`--to-wxid`**、**`--card-wxid`**、**`--card-nickname`**;`--card-alias` |
| `message send-appmsg` | 发 AppMsg(视频号/聊天记录/音乐等) | **`--to-wxid`**、**`--xml`/`--xml-file`**;提供 ori* 参数则按转发发送 |
| `message revoke` | 撤回消息(newMsgId/createTime 取自发送响应) | **`--to-wxid`**、**`--new-msg-id`**、**`--create-time`** |

## 转发(同一内容发多人:先 send-* 发第一人,再 forward-*,效率更高)

**技巧**:把发送接口的完整响应(stdout 原始 JSON)存文件,再 `forward-* --to-wxid 下一人 --data @resp.json` 即可。CLI 会**自动解包**响应包裹(取其中的 `data`)并**自动补全 API 必需的 ori 字段**:
- `oriMsgId ← newMsgId`
- `oriMsgSourceBase64 ← msgSourceBase64`
- `oriMsgTo ← 响应中的 toWxid`(原接收人)
- `oriMsgFrom ← 当前账号 wxid`(取所选账号记录,由 `--app-id` 决定)

因此通常**只需再补 `--to-wxid` 指定新接收人**(显式 flag 优先于 `--data`)。若响应用 `jq .data` 只存了内层对象,也同样可用。

| 命令 | 数据来源 | 关键参数 |
|---|---|---|
| `message forward-image` | send-image 的响应 | **`--to-wxid`** + CDN 字段(`--file-id --file-md5 --aes-key --big-img-size --mid-img-size --thumb-img-width/height/size`;ori 自动补全) |
| `message forward-image-msg` | 收到图片消息的 xml | **`--to-wxid`**、**`--xml`/`--xml-file`**;ori 字段可选 |
| `message forward-video` | send-video 的响应 | **`--to-wxid`** + CDN 字段(`--file-id --file-md5 --aes-key --new-md5 --crc32 --file-size --play-length --raw-file-id/md5/aes-key/size --thumb-width/height/size`;ori 自动补全) |
| `message forward-video-msg` | 收到视频消息的 xml | **`--to-wxid`**、**`--xml`/`--xml-file`** |
| `message forward-file` | send-file 的响应 | **`--to-wxid`**、**`--file-name`** + CDN 字段(`--file-id --file-md5 --aes-key --file-crc --file-size`;ori 自动补全) |
| `message forward-file-msg` | 收到文件消息的 xml | **`--to-wxid`**、**`--xml`/`--xml-file`** |
| `message forward-link` | send-link 的响应 | **`--to-wxid`**、**`--title`**、**`--link-url`** + CDN 字段(`--aes-key --thumb-url --thumb-md5 --thumb-width/height/size --req-id`;ori 自动补全) |
| `message forward-link-msg` | 收到链接消息的 xml | **`--to-wxid`**、**`--xml`/`--xml-file`** |
| `message forward-miniapp` | 收到小程序消息的 xml | **`--to-wxid`**、**`--xml`/`--xml-file`** + ori 字段 |

> ori 字段 = `--ori-msg-id/--ori-msg-from/--ori-msg-to/--ori-msg-source`(原消息 newMsgId、发送/接收人 wxid、MsgSource,自动 base64)。除 `forward-miniapp`(来自接收消息的 xml)外,基于发送响应的 `forward-image/video/file/link` 均会自动补全,无需手填。完整字段含义见 `$WEKEAPI message forward-image --help`。

> 发到朋友圈不是消息模块:链接聊天消息 → 朋友圈用 wekeapi-sns 的 `sns forward-link-msg`,视频号消息/视频号朋友圈 → 朋友圈用 `sns forward-finder`(均以 `--xml/--xml-file` 传原消息 xmlMsg)。

## 下载(均支持 `--out <路径>` 直接保存文件)

| 命令 | 说明 | 参数 |
|---|---|---|
| `message download-voice` | 下载语音 | **`--new-msg-id`**、**`--xml`/`--xml-file`**、**`--format`** 1-SILK/2-WAV、**`--from-wxid`** |
| `message download-image` | 下载图片 | **`--type`** 1-原图/2-常规/3-缩略、**`--xml`/`--xml-file`**;无对应规格返回 -33 |
| `message download-video` | 下载视频 | **`--type`** 1-原视频/2-常规/3-缩略、**`--xml`/`--xml-file`** |
| `message download-file` | 下载文件(xml 中 type=6 的消息) | **`--xml`/`--xml-file`** |
| `message download-emoji` | 下载 Emoji(URL 7 天有效) | **`--xml`/`--xml-file`** |
| `message download-cdn` | 无 xml 时用 CDN 字段下载 | **`--type`** 1-高清图/2-常规图/3-缩略图/4-视频/5-文件、**`--file-id`**、**`--aes-key`**、**`--file-size`** |

## 示例

```bash
# 群里发文本并@所有人
$WEKEAPI message send-text --token T --app-id A --to-wxid 12345@chatroom --content '@all 开会了' --ats all

# 发图片给第一人,用响应转发给其他人(高效群发)
$WEKEAPI message send-image --token T --app-id A --to-wxid wxid_a --file ./photo.jpg > resp.json
$WEKEAPI message forward-image --token T --app-id A --to-wxid wxid_b --data @resp.json

# 下载收到的图片原图
$WEKEAPI message download-image --token T --app-id A --type 1 --xml '<msg><img .../></msg>' --out ./dl.jpg
```

## 发送后自动落库(自己发的消息也会记录)

`send-*` 与 `forward-*` 命令成功后,CLI 会自动把这条消息写入运行中的 wekeapi-msg-sync,供后续查询:

- `from` 取配置里的本账号 wxid;`to`/`new_msg_id`/`create_time` 取发送响应(缺失时回落到请求体/当前时间);`msg_type` 按命令映射(文本 1、图片 3、语音 34、视频 43、名片 42、表情 47、链接/文件/小程序/AppMsg 49)。
- `content` 只存可检索文本:文本存内容、链接存「标题 + 地址」、文件存文件名、名片存昵称;图片/语音/视频等媒体类留空(**不会**把 base64 文件数据写进数据库)。
- 查询验证:`$WEKEAPI data messages --conversation-id S:<对端 wxid>|R:<群id>`,返回项里 `from` 为本账号 wxid,即本人发出。
- 失败不影响发送结果:服务未配置/未运行时直接跳过;写入报错只在 stderr 输出 `warn:`,stdout 仍是发送接口的原始 JSON,退出码不变。
- 若平台同时通过回调推送了该消息,按 `(wx_id, new_msg_id)` 幂等去重,不会出现重复记录。

## 注意

- **发送间隔(硬性要求)**:所有发送类接口(`send-*` 与 `forward-*`)连续执行时,两次调用之间必须**间隔 3 秒以上**,且只能串行逐条发送,禁止并发批量发送。短时间内连续发送会返回 `-12 调用超限`,遇 `-12` 时停止发送、等待更长时间后再重试。
- **撤回窗口**:微信撤回仅在约 2 分钟内有效,超时返回 `-52`(后端 `[-430]`)。需要撤回时请"先发后立即撤"(拿到 newMsgId/createTime 后马上调 `revoke`)。
- **目标不校验**:向不存在或非法的 `--to-wxid` 发送文本,服务端不做校验,仍返回 `code:0`(不会报业务错误);请自行确保目标 wxid/群 ID 正确。
- **语音格式**:`send-voice` 仅支持 wav / 原生 SILK,其它格式返回 `-30 不支持的格式`。
- 消息存储由 wekeapi-msg-sync 负责,查询用 `$WEKEAPI data messages`;发送/转发命令成功后会主动上报落库(见上文),服务未运行时仅跳过上报,不写本地数据库。

Versions

The database has no other skills named wekeapi-message.

Database snapshot: 13.11.2026 · package version ee689da7332a (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100wekeapi-contact
    wekeapi CLI contact 模块:微信通讯录(好友列表/简要/详细信息、通讯录同步、搜索联系人、添加/同意/删除好友、备注、仅聊天权限、企微好友、手机通讯录)。当用户要求查好友、搜索微信号、加好友、删好友、改备注、查企微联系人、上传手机通讯录,或需要把昵称/备注/微信号解析成 wxid、查询 wekeapi-msg-sync 中的联系人数据时使用。
  • 100wekeapi-autoreply
    wekeapi 微信消息实时监听与回复触发:用内置 Node 脚本轮询 wekeapi-msg-sync 的新消息并呈现给会话,提供串行发送触发;回复内容与风格由用户自行设计,skill 只负责监听/呈现/发送机制。当用户要求监听微信消息、实时接收新消息、挂机监听并触发回复时使用。支持多账号、私聊+群里被@、防多账号互回死循环、发送间隔3秒、同步延迟去重。

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.