personal-wechat

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Personal WeChat via Wisdom

通过Wisdom操作个人微信

Use the user's self-hosted Wisdom service to operate their personal WeChat account. Wisdom runs on a Windows host with WeChat Desktop logged in and exposes an HTTP API.
Credentials are injected by the
personalwechat
BYOC connector:
  • PERSONALWECHAT_BASE_URL
    — Wisdom server base URL, e.g.
    http://82.156.126.14:8000
    .
  • PERSONALWECHAT_API_TOKEN
    — Wisdom
    API_TOKEN
    . Secret — never echo, print, or log it.
The helper sends the token as
Authorization: Bearer ...
; it never puts the token in the URL. For queued UI operations such as search and send, the helper submits the task and waits for
/api/tasks/{id}
before printing the final result.
This is the user's real personal WeChat account. Read operations can run directly. Sending messages or files must be dry-run first, then performed only after the user explicitly approves the exact target and content.
使用用户自托管的Wisdom服务操作其个人微信账号。Wisdom运行在已登录微信桌面版的Windows主机上,并提供HTTP API。
凭证由
personalwechat
BYOC连接器注入:
  • PERSONALWECHAT_BASE_URL
    — Wisdom服务器基础URL,例如
    http://82.156.126.14:8000
  • PERSONALWECHAT_API_TOKEN
    — Wisdom的
    API_TOKEN
    。属于机密信息——绝不要回显、打印或记录它。
辅助工具会将令牌以
Authorization: Bearer ...
的形式发送;绝不会将令牌放入URL中。对于搜索和发送等需要排队的UI操作,辅助工具会提交任务并等待
/api/tasks/{id}
接口返回后再打印最终结果。
这是用户的真实个人微信账号。读取操作可直接执行。发送消息或文件必须先进行试运行,仅在用户明确批准确切的接收对象和内容后才可执行。

CLI

CLI

The skill ships a stdlib-only helper:
bash
WX=$SKILL_DIR/scripts/personal_wechat.py
该技能附带一个仅依赖标准库的辅助工具:
bash
WX=$SKILL_DIR/scripts/personal_wechat.py

Verify Connection First

先验证连接状态

Always start with status when the user asks to use WeChat:
bash
python3 $WX status
Expected healthy shape:
json
{"auth":{"logged_in":true,"wechat_running":true,"page":"logged_in"}}
If
logged_in=false
, tell the user to open the Wisdom web UI / RDP and scan the WeChat QR code. If the API returns 401, ask the user to reconnect the Personal WeChat connector with the current Wisdom API token.
当用户要求使用微信时,始终先检查状态:
bash
python3 $WX status
预期的健康状态返回格式:
json
{"auth":{"logged_in":true,"wechat_running":true,"page":"logged_in"}}
如果
logged_in=false
,告知用户打开Wisdom网页UI/RDP并扫描微信二维码。如果API返回401,请用户使用当前Wisdom API令牌重新连接Personal WeChat连接器。

Read Workflows

读取类工作流

Current Account

当前账号信息

bash
python3 $WX account
bash
python3 $WX account

Contacts

联系人列表

bash
python3 $WX contacts --limit 50
bash
python3 $WX contacts --limit 50

Recent Conversations

最近会话

Use the normal conversations endpoint first; it prefers WeChat DB when ready and falls back to Wisdom's app DB.
bash
python3 $WX conversations --limit 20
For decrypted local WeChat history sessions:
bash
python3 $WX conversations --history --limit 20
优先使用常规会话接口;当微信数据库就绪时会优先调用它,否则回退到Wisdom的应用数据库。
bash
python3 $WX conversations --limit 20
如需获取解密后的本地微信历史会话:
bash
python3 $WX conversations --history --limit 20

Messages in a Conversation

会话中的消息

First list conversations, then use the
id
as
conversation_id
:
bash
python3 $WX messages "34642176898@chatroom" --limit 50 --order asc
先列出会话,然后将会话
id
作为
conversation_id
使用:
bash
python3 $WX messages "34642176898@chatroom" --limit 50 --order asc

Historical Messages

历史消息

Read from Wisdom's decrypted WeChat local databases:
bash
python3 $WX history --limit 50
python3 $WX history --talker "34642176898@chatroom" --limit 50
python3 $WX history --limit 20 --offset 20
从Wisdom解密后的微信本地数据库读取:
bash
python3 $WX history --limit 50
python3 $WX history --talker "34642176898@chatroom" --limit 50
python3 $WX history --limit 20 --offset 20

Raw SQL, Read-Only Only

仅允许只读的原始SQL

Wisdom permits only
SELECT
and
PRAGMA
:
bash
python3 $WX sql MicroMsg.db 'SELECT count(*) AS cnt FROM Session'
Use raw SQL only for diagnostics or targeted metadata queries. Do not dump large message tables unless the user explicitly asks.
Wisdom仅允许执行
SELECT
PRAGMA
语句:
bash
python3 $WX sql MicroMsg.db 'SELECT count(*) AS cnt FROM Session'
仅在诊断或针对性元数据查询时使用原始SQL。除非用户明确要求,否则不要导出大型消息表。

Refresh History DB

刷新历史数据库

If history looks stale, refresh the decrypted DB snapshot:
bash
python3 $WX refresh-history
如果历史记录看起来过时,刷新解密后的数据库快照:
bash
python3 $WX refresh-history

Search

搜索

bash
python3 $WX search "Alice"
Search drives the WeChat UI, so it may be slower than local DB history reads.
bash
python3 $WX search "Alice"
搜索操作会调用微信UI,因此可能比读取本地数据库历史记录慢。

Sending Messages — GATED

发送消息——受管控

send
dry-runs by default. It never sends unless
--confirm
is present, or unless an AceDataCloud scheduled task pre-authorized this Skill and you use
--unattended-confirm
.
bash
python3 $WX send "Alice" "今晚 8 点开会吗?"
默认情况下
send
命令会执行试运行。除非添加
--confirm
参数,或者AceDataCloud定时任务已预先授权该技能并使用
--unattended-confirm
参数,否则绝不会发送消息。
bash
python3 $WX send "Alice" "今晚 8 点开会吗?"

-> {"dry_run": true, ...}

-> {"dry_run": true, ...}


Show the dry-run output to the user and ask for explicit approval of the exact
recipient and text. Only then run:

```bash
python3 $WX send "Alice" "今晚 8 点开会吗?" --confirm
Never add
--confirm
in the first attempt. Never infer consent from vague text. The user must clearly approve sending this exact message.

将试运行结果展示给用户,并请求其明确批准确切的接收人和消息内容。仅在获得批准后再运行:

```bash
python3 $WX send "Alice" "今晚 8 点开会吗?" --confirm
首次尝试绝不要添加
--confirm
参数。绝不要从模糊的文本中推断用户同意。用户必须明确批准发送这条确切的消息。

Scheduled-task unattended confirmation

定时任务无人值守确认

When running inside an AceDataCloud scheduled task, the platform may pre-authorize specific Skills for unattended execution. If all of these are true:
  • AICHAT_UNATTENDED_MODE=true
  • AICHAT_ACTIVE_SKILL
    is
    personal-wechat
    or
    acedatacloud/personal-wechat
  • AICHAT_ACTIVE_SKILL
    appears in
    AICHAT_UNATTENDED_ALLOWED_SKILLS
then the user has pre-authorized this Skill for that scheduled task. In that case, use:
bash
python3 $WX send "Alice" "今晚 8 点开会吗?" --unattended-confirm
If the helper returns
unattended_confirmation_denied
, do not retry with
--confirm
; report the dry-run and explain that the task needs this Skill to be selected in its unattended authorization settings.
在AceDataCloud定时任务中运行时,平台可能会预先授权特定技能进行无人值守执行。当以下所有条件都满足时:
  • AICHAT_UNATTENDED_MODE=true
  • AICHAT_ACTIVE_SKILL
    personal-wechat
    acedatacloud/personal-wechat
  • AICHAT_ACTIVE_SKILL
    出现在
    AICHAT_UNATTENDED_ALLOWED_SKILLS
则用户已预先授权该技能用于该定时任务。此时使用:
bash
python3 $WX send "Alice" "今晚 8 点开会吗?" --unattended-confirm
如果辅助工具返回
unattended_confirmation_denied
,不要尝试使用
--confirm
重试;请告知用户试运行结果,并说明该定时任务需要在无人值守授权设置中选中此技能。

Safety Rules

安全规则

  • Never print
    PERSONALWECHAT_API_TOKEN
    .
  • Treat
    PERSONALWECHAT_BASE_URL + API_TOKEN
    as full remote control of the user's WeChat.
  • For normal chat write/send operations: dry-run first, ask for explicit approval, then re-run with
    --confirm
    .
  • For scheduled-task unattended writes: use
    --unattended-confirm
    only when the platform env says this Skill is pre-authorized.
  • Do not call logout/restart endpoints from the skill unless the user explicitly asks to repair the Wisdom service.
  • If Wisdom returns 503 for history, run
    python3 $WX refresh-history
    once, then retry the read.
  • If the server is unreachable, ask the user to check the Windows host / security group / port 8000.
  • 绝不要打印
    PERSONALWECHAT_API_TOKEN
  • PERSONALWECHAT_BASE_URL + API_TOKEN
    视为对用户微信的完全远程控制权。
  • 对于常规聊天写入/发送操作:先执行试运行,请求明确批准,然后添加
    --confirm
    参数重新运行。
  • 对于定时任务无人值守写入:仅当平台环境表明该技能已预先授权时,才使用
    --unattended-confirm
    参数。
  • 除非用户明确要求修复Wisdom服务,否则不要从技能中调用注销/重启接口。
  • 如果Wisdom返回503错误(历史记录相关),运行一次
    python3 $WX refresh-history
    ,然后重试读取操作。
  • 如果服务器无法访问,请用户检查Windows主机/安全组/8000端口。

Endpoint Mapping

端点映射

The helper wraps these Wisdom endpoints:
  • GET /api/status
  • GET /api/auth/status
  • GET /api/account
  • GET /api/contacts?version=2.0
  • GET /api/conversations
  • GET /api/conversations/history
  • GET /api/messages
  • GET /api/messages/history
  • POST /api/messages/history/query
  • POST /api/messages/history/refresh
  • POST /api/search
  • POST /api/messages/send
    (only after
    --confirm
    or verified
    --unattended-confirm
    )
辅助工具封装了以下Wisdom端点:
  • GET /api/status
  • GET /api/auth/status
  • GET /api/account
  • GET /api/contacts?version=2.0
  • GET /api/conversations
  • GET /api/conversations/history
  • GET /api/messages
  • GET /api/messages/history
  • POST /api/messages/history/query
  • POST /api/messages/history/refresh
  • POST /api/search
  • POST /api/messages/send
    (仅在添加
    --confirm
    或验证通过的
    --unattended-confirm
    参数后调用)