wechat-binding
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese📱 WeChat Binding
📱 微信绑定
Connect / reconnect / disconnect the user's WeChat account so the agent can push messages via .
send_to_wechatThe tool stays built-in. This SKILL.md is the reference doc.
wechat连接/重新连接/断开用户的微信账号,以便Agent可以通过推送消息。
send_to_wechatwechatSee also
相关文档
- — how to actually send messages once bound
config/context/references/messaging-channels.md - — analogous Telegram flow
skills/tg-bot-binding/SKILL.md
- —— 绑定完成后如何实际发送消息
config/context/references/messaging-channels.md - —— 类似的Telegram绑定流程
skills/tg-bot-binding/SKILL.md
Typical binding flow
典型绑定流程
qrcode → user scans → qrcode_status(qrcode=...) → connect(bot_token=...)- Generate QR: — saves an image to workspace, returns
wechat(action="qrcode")(id) +qrcode.file_path - Show the QR to the user. On web channel: include the so the frontend renders the image. On TG/WeChat channel: send the image via
file_pathwith thesend_to_telegram.file_path - Wait for the user to scan + confirm in WeChat. Don't auto-poll — let them say "scanned" / "done" first.
- Poll for completion: . Returns
wechat(action="qrcode_status", qrcode=<id from step 1>)once scan + confirm completes.bot_token - Connect: . Optional:
wechat(action="connect", bot_token=<from step 4>),ilink_bot_idif the user has multiple WeChat accounts.ilink_user_id - Confirm to user: "WeChat connected. You can now push messages with send_to_wechat."
qrcode → 用户扫码 → qrcode_status(qrcode=...) → connect(bot_token=...)- 生成二维码: —— 将图片保存至工作区,返回
wechat(action="qrcode")(ID)和qrcode。file_path - 向用户展示二维码:在Web渠道中,回复内容包含,由前端渲染图片;在Telegram/微信渠道中,通过
file_path传入send_to_telegram发送图片。file_path - 等待用户扫码并在微信中确认:不要自动轮询,等待用户发送“已扫码”/“完成”等确认信息。
- 轮询完成状态: 。当用户完成扫码和确认后,返回
wechat(action="qrcode_status", qrcode=<步骤1中的ID>)。bot_token - 完成连接: 。可选参数:若用户有多个微信账号,可传入
wechat(action="connect", bot_token=<步骤4返回值>)、ilink_bot_id。ilink_user_id - 向用户确认: “微信已连接。现在你可以使用send_to_wechat推送消息。”
Actions
操作列表
| action | required | purpose |
|---|---|---|
| — | Current WeChat connection state. Use before reconnect, to verify binding. |
| — | Generate QR code image (saved to workspace). Returns |
| | Poll whether user has scanned + confirmed. Returns |
| | Complete a NEW WeChat connection (after first-ever QR scan). Optional: |
| — | Terminate current WeChat session (unlink). |
| | Re-establish a previously-bound WeChat (token from a fresh QR scan). |
| action | 必填项 | 用途 |
|---|---|---|
| — | 当前微信连接状态。重新连接前使用,用于验证绑定状态。 |
| — | 生成二维码图片(保存至工作区)。返回 |
| | 轮询用户是否已扫码并确认。成功时返回 |
| | 完成首次微信连接(首次扫码后)。可选参数: |
| — | 终止当前微信会话(解绑)。 |
| | 重新建立之前绑定过的微信连接(需通过新扫码获取token)。 |
connect vs. reconnect
connect与reconnect的区别
- — first-time binding. The user has NEVER bound this WeChat before.
connect - — the user was previously connected, the connection dropped (e.g. ilink session expired), and they just scanned a fresh QR.
reconnect
When in doubt, call first:
status- + no prior history →
connected: falseconnect - + prior history exists →
connected: falsereconnect
- —— 首次绑定。用户从未绑定过该微信账号。
connect - —— 用户之前已连接过,但连接已中断(如ilink会话过期),且刚完成新的扫码操作。
reconnect
不确定时,先调用:
status- + 无绑定历史 → 使用
connected: falseconnect - + 存在绑定历史 → 使用
connected: falsereconnect
Channel-aware QR display
适配不同渠道的二维码展示方式
| User channel | How to show the QR |
|---|---|
| Web | Include |
| Telegram | |
| (You can't — they're trying to bind WeChat in the first place. Tell them to open the web app.) |
| 用户渠道 | 二维码展示方式 |
|---|---|
| Web | 在回复中包含 |
| Telegram | |
| (无法展示——用户本身就是要绑定微信,告知用户打开Web应用操作) |
Critical rules
重要规则
- Don't auto-poll after
qrcode_status. Wait for user confirmation that they scanned + confirmed in WeChat. Auto-polling spams the upstream API.qrcode - Each call generates a fresh image. Don't re-use an old
qrcodeid with a new image — the upstream session is tied to the id.qrcode - Never paste in chat. It's a credential. Once you have it from
bot_token, immediately pass it toqrcode_status/connectand don't echo it back to the user.reconnect - is destructive — confirm with the user before calling it.
disconnect
- 生成二维码后不要自动轮询:等待用户确认已在微信中扫码并完成授权。自动轮询会对上游API造成请求轰炸。
qrcode_status - 每次调用都会生成新的图片:不要将旧的
qrcodeID与新图片复用——上游会话与ID绑定。qrcode - 切勿在聊天中粘贴:这是敏感凭证。从
bot_token获取后,立即传入qrcode_status/connect,不要回显给用户。reconnect - 操作具有破坏性:调用前需向用户确认。
disconnect