
ItChat
A Python library for automating a personal WeChat account, such as building simple chat bots.
- Stars
- 26.5k
- Forks
- 5.6k
- Licence
- MIT
- Language
- Python
- Last update
- 3.1 years ago
- Type
- Library
No commits in over a year — check for forks or alternatives before adopting.
What it is
ItChat is a Python library that lets a program log in to a personal WeChat account and send, receive and reply to messages. People use it to build simple chat bots, auto-replies, or scripts that handle WeChat messages, files and friend searches. The README says the basic bot can be written in under thirty lines of code.
- Send a message to the File Transfer Helper account with a few lines of code
- Reply automatically to incoming text messages
- Download pictures, videos and attachments received in chats
- Search your friend list by nickname or WeChat ID
- Run a second login instance with new_instance()
Great for
- Python developers who want to script a personal WeChat account
- Hobbyists building a simple auto-reply bot
- People who want to experiment with message handlers and file downloads
Not ideal for
- Business teams needing an official WeChat integration, since this uses a personal account interface rather than the official public-account API (see the README's separate itchatmp project)
- Anyone who needs guaranteed long-term stability, since the last push shown is from September 2023 and WeChat changes can break unofficial clients
- Users who are not comfortable scanning a login QR code and running Python scripts
How to get it
- 1
Install with a package manager
You'll need: Python 3 (README references Python 2.7 and 3.5 badges; check current compatibility)
Install from PyPI
pip install itchat - 2
Run it
- Install the package with pip install itchat
- Create a Python file that imports itchat and calls itchat.auto_login()
- Call itchat.send('Hello, filehelper', toUserName='filehelper') to send a test message
- Scan the login QR code shown in the terminal or browser when prompted
- 3
Get the most out of it
- Use @itchat.msg_register with content types like TEXT, PICTURE or FRIENDS to route different message kinds
- Pass hotReload=True to auto_login to avoid rescanning the QR code within a time window
- Use enableCmdQR to display the login QR code in the terminal, with adjustments for different consoles
- Use loginCallback and exitCallback to run code after login or logout
- Use search_friends with name or wechatAccount to look up contacts
Downloads
Strengths
- Short, readable API with decorator-based message handlers, as shown in the README examples
- Covers text, pictures, video, files, friend requests and group chats in one interface
- MIT licensed and widely starred on GitHub
Trade-offs
- Relies on unofficial access to personal WeChat accounts, so its continued function is not guaranteed by WeChat
- README is partly in Chinese and the English version is a separate file, so setup docs may be harder to follow
- Some accounts cannot send messages to themselves, according to the FAQ, so filehelper is suggested as a workaround
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| ItChat (this) | 26.5k | Library | intermediate | 3.1 years ago | Python developers who want to script a personal WeChat account |
| wxpy | 14.3k | Library | advanced | 7.3 years ago | Python developers studying how WeChat personal-account bots were built before 2019 |
| EverydayWechat | 10.3k | App | intermediate | 5.4 years ago | Developers comfortable editing YAML and running Python scripts |
| imgui | 76.9k | Library | intermediate | 7 days ago | Game developers who want an in-engine debug or tools panel |
| GPT_API_free | 45.3k | Other | beginner | 7 days ago | Students and researchers doing non-commercial experiments with LLM APIs |
| ccxt | 44.7k | Library | intermediate | 4 days ago | Developers building trading bots or algorithmic trading software |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.