Skip to content

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
Step-by-step guide: how to use ItChatInstall, first run, examples, tips and FAQs

How to get it

  1. 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. 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. 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

ProjectStarsTypeLevelUpdatedBest for
ItChat (this)26.5kLibraryintermediate3.1 years agoPython developers who want to script a personal WeChat account
wxpy14.3kLibraryadvanced7.3 years agoPython developers studying how WeChat personal-account bots were built before 2019
EverydayWechat10.3kAppintermediate5.4 years agoDevelopers comfortable editing YAML and running Python scripts
imgui76.9kLibraryintermediate7 days agoGame developers who want an in-engine debug or tools panel
GPT_API_free45.3kOtherbeginner7 days agoStudents and researchers doing non-commercial experiments with LLM APIs
ccxt44.7kLibraryintermediate4 days agoDevelopers 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.