Playground
Try the WeChat Bot SDK directly in your browser. The example below runs in a real Node.js environment powered by StackBlitz WebContainers.
TIP
This is a live editor — you can modify the code and see changes in real time. The terminal on the right shows the bot output.
Browser API Demo
Scan a QR code to start long polling, receive new messages, and reply from a browser chat UI.
WARNING
ilinkai.weixin.qq.com does not expose the CORS headers required by browsers. This demo is rendered only during local development and uses the VitePress dev server proxy (/ilink -> https://ilinkai.weixin.qq.com). Static production deployments need their own backend, edge function, or gateway proxy.
Echo Bot Example
More Examples
examples/basic— Minimal echo bot with QR loginexamples/commands— Command-based bot (/help,/ping,/echo,/id)examples/media— Media bot withsendFile()andsendImage()examples/ai-chat— DeepSeek-powered chat bot with per-user context
What's Happening
- The code calls
bot.login()to get a QR code URL - You scan the QR with WeChat to authenticate
- Once confirmed, the bot starts long-polling for messages
- Any text message you send gets echoed back with "Echo: " prefix
Try It Yourself
Things you can try in the editor:
- Change the echo prefix from
"Echo: "to something else - Add image detection (check
MessageItemType.IMAGE) - Add a command system (e.g.
/help,/ping)
Run Locally
Prefer running locally? Just:
bash
git clone https://github.com/YunYouJun/weixin-ts
cd weixin-ts
pnpm install
pnpm example