WeChat Bot: Wire Up Your Pi Agents with a QR Login
Ever wanted to automate your WeChat conversations or run a bot that responds to messages without jumping through hoops? This project does exactly that: it lets you hook your own AI agents—like Pi or any custom logic—into WeChat, using nothing more than a QR code scan and the Wechaty library. No official API headaches, no complicated setup. Just scan, log in, and let your bot loose.
What It Does
This is a straightforward WeChat bot built on top of Wechaty, an open-source framework for WeChat account automation. The key trick? It uses QR code login, which means you don't need a developer account or special permissions. You just run the bot, scan the QR with your phone's WeChat, and your bot is live. It can then receive and send messages, manage groups, or integrate with an external AI like Pi to do more complex tasks.
The repo is lightweight and focused: it's essentially a minimal scaffolding to get a WeChat bot running fast, with example hooks for custom message handling.
Why It’s Cool
- No OAuth headache. WeChat's official APIs are infamous for their complexity and strict approval process. This bypasses all that by using the personal account's QR login via Wechaty. It's not for production SaaS, but it's perfect for personal use or prototyping.
- Agent-ready. The example code shows how to pipe incoming messages to an external AI (like Pi) and send back the response. If you've got a local LLM, a custom script, or any API endpoint, you can plug it in here.
- Minimal setup. Clone, install dependencies, run, scan. That's it. No server config, no webhook tunnel, no cloud deployment needed.
- Open source, hackable. It's a small codebase (under 100 lines of core logic), so you can easily extend it to handle attachments, reply patterns, or even trigger commands.
How to Try It
-
Clone the repo:
git clone https://github.com/wangrongding/wechat-bot.git cd wechat-bot -
Install dependencies (Node.js required):
npm install -
Run the bot:
node index.js -
Scan the QR code that appears in your terminal using the WeChat app on your phone.
-
Send a message to your own account or a group where the bot is present. By default, it echoes back whatever you say. You can swap in your own logic inside the
onMessagehandler.
For deeper integration (like connecting to Pi or another AI agent), check the example in the repo's README. It shows a simple HTTP call pattern you can adapt.
Final Thoughts
This project isn't trying to be a production-grade platform—it's a tool for devs who want to play with WeChat automation without bureaucracy. If you've ever wanted to give your personal WeChat a brain (or just a smart autoreply), this is the easiest ramp I've seen. It's also a solid foundation if you're experimenting with personal AI assistants that need a chat interface.
Give it a try, hack on the message handler, and see what you can make it do. The hardest part is still coming up with a good use case—not setting up the bot.
Brought to you by @githubprojects