WeixinBot
网页版微信API,包含终端版微信及微信机器人
A Python library that automates a WeChat account through its browser interface, letting you send and receive messages, set up auto-replies, and handle contacts from code, after scanning a QR code to log in.
WeixinBot is a Python project that wraps the web version of WeChat, the Chinese messaging platform, and turns it into a programmable bot framework. WeChat has a browser-based interface that the project reverse-engineered to understand the underlying API calls, and this library automates those calls so you can control a WeChat account from Python code.
The flow works like this: the program generates a QR code, you scan it with the WeChat app on your phone to authorize the session, and the bot then logs in and can send and receive messages on your behalf. An auto-reply mode can be enabled so that incoming text messages, including messages from group chats, receive automatic responses. The library also handles other message types that WeChat supports: contact cards, shared links, animated stickers, and location pins.
The README is written in Chinese and includes detailed documentation of the WeChat web API endpoints that the project discovered through inspection. This covers the login sequence (getting a UUID, displaying the QR code, polling for scan confirmation), session initialization, fetching the contact list, message synchronization, and sending various message types. Each endpoint entry lists the URL, HTTP method, required parameters, and the structure of the response. This makes the repository useful both as a working bot and as a reference for the internal API.
The project targets Python 2.7 and Python 3.6. Dependencies are installed via pip. The README notes that screenshots and documented features may not reflect the latest code, and directs readers to check the source directly for the current state.
Note that WeChat's terms of service do not permit automated access of this kind, so this project operates in a legally grey area and the underlying web API it relies on is subject to change without notice. The repository has not received recent updates.
Where it fits
- Build an auto-reply bot for a WeChat account that responds to incoming text messages and group chat messages automatically.
- Send WeChat messages from a Python script to automate notifications or alerts.
- Use the documented API reference to understand WeChat's internal web endpoints for login, contact sync, and message sending.