Wechat Binding

作者 starchild-ai-agentf3c2d4997f75无许可证27 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

WeChat binding: QR scan, bind, unbind, reconnect, status check. Use when setting up or repairing WeChat delivery (e.g. connect WeChat, scan QR, why isn't WeChat pushing, disconnect WeChat).

仅含说明Communication
AI 生成的概览

指导绑定、重新连接和断开用户的微信账号,以便智能体推送消息。

功能
这份参考文档描述了通过二维码将微信账号关联到智能体的流程:生成二维码图片,让用户扫码并确认,轮询获取生成的 bot token,然后完成连接。文档说明了可用操作(status、qrcode、qrcode_status、connect、disconnect、reconnect)、首次连接与重新连接的区别,以及如何根据用户所在渠道展示二维码。文档还列出了若干规则,例如不要自动轮询、不要复用二维码 id、不要回显 bot token。
适用场景
适用于设置或修复微信消息推送的场景,例如首次连接微信、会话中断后重新连接、检查绑定状态或断开微信。
运行要求
需要内置的 wechat 工具及其各项操作,以及一个用于扫码的微信账号;该技能仅为说明文档,不附带脚本。文档引用了相关文件,如 config/context/references/messaging-channels.md 和 skills/tg-bot-binding/SKILL.md。

📱 WeChat Binding

Connect / reconnect / disconnect the user's WeChat account so the agent can push messages via send_to_wechat.

The wechat tool stays built-in. This SKILL.md is the reference doc.

See also

  • config/context/references/messaging-channels.md — how to actually send messages once bound
  • skills/tg-bot-binding/SKILL.md — analogous Telegram flow

Typical binding flow

qrcode → user scans → qrcode_status(qrcode=...) → connect(bot_token=...)
  1. Generate QR: wechat(action="qrcode") — saves an image to workspace, returns qrcode (id) + file_path.
  2. Show the QR to the user. On web channel: include the file_path so the frontend renders the image. On TG/WeChat channel: send the image via send_to_telegram with the file_path.
  3. Wait for the user to scan + confirm in WeChat. Don't auto-poll — let them say "scanned" / "done" first.
  4. Poll for completion: wechat(action="qrcode_status", qrcode=<id from step 1>). Returns bot_token once scan + confirm completes.
  5. Connect: wechat(action="connect", bot_token=<from step 4>). Optional: ilink_bot_id, ilink_user_id if the user has multiple WeChat accounts.
  6. Confirm to user: "WeChat connected. You can now push messages with send_to_wechat."

Actions

actionrequiredpurpose
status—Current WeChat connection state. Use before reconnect, to verify binding.
qrcode—Generate QR code image (saved to workspace). Returns qrcode id + file_path.
qrcode_statusqrcodePoll whether user has scanned + confirmed. Returns bot_token on success.
connectbot_tokenComplete a NEW WeChat connection (after first-ever QR scan). Optional: ilink_bot_id, ilink_user_id.
disconnect—Terminate current WeChat session (unlink).
reconnectbot_tokenRe-establish a previously-bound WeChat (token from a fresh QR scan).

connect vs. reconnect

  • connect — first-time binding. The user has NEVER bound this WeChat before.
  • reconnect — the user was previously connected, the connection dropped (e.g. ilink session expired), and they just scanned a fresh QR.

When in doubt, call status first:

  • connected: false + no prior history → connect
  • connected: false + prior history exists → reconnect

Channel-aware QR display

User channelHow to show the QR
WebInclude file_path in your reply — frontend renders it inline
Telegramsend_to_telegram(file_path=<qr_path>, message_type="photo")
WeChat(You can't — they're trying to bind WeChat in the first place. Tell them to open the web app.)

Critical rules

  • Don't auto-poll qrcode_status after qrcode. Wait for user confirmation that they scanned + confirmed in WeChat. Auto-polling spams the upstream API.
  • Each qrcode call generates a fresh image. Don't re-use an old qrcode id with a new image — the upstream session is tied to the id.
  • Never paste bot_token in chat. It's a credential. Once you have it from qrcode_status, immediately pass it to connect / reconnect and don't echo it back to the user.
  • disconnect is destructive — confirm with the user before calling it.

来源与署名

来源:starchild-ai-agent/official-skills位于wechat-binding提交f3c2d49

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架