explaingit

youfou/wxpy

14,263PythonAudience · developerComplexity · 2/5Setup · moderate

TLDR

A Python library for automating a WeChat personal account, log in by scanning a QR code, then send messages, auto-respond to chats, manage groups, and build chatbots with simple Python scripts.

Mindmap

mindmap
  root((repo))
    What it does
      WeChat automation
      Python scripting
      QR code login
    Features
      Send messages
      Auto reply
      Group management
      Accept friend requests
    Use cases
      Chatbots
      Log forwarding
      Smart home control
      Message forwarding
    Limits
      Web login only
      Account ban risk
      Python 2.7 and 3.4 to 3.6
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a chatbot that automatically responds to specific WeChat messages based on keyword rules, without touching the app manually.

USE CASE 2

Forward log output or error alerts from Python scripts directly to yourself on WeChat for monitoring.

USE CASE 3

Automate group chat management by creating groups, inviting contacts, and forwarding messages between accounts.

Tech stack

Python

Getting it running

Difficulty · moderate Time to first run · 30min

WeChat web login required, bot accounts risk being blocked from the WeChat web client, strongly recommended to use a spare secondary account.

In plain English

wxpy is a Python library for automating a WeChat personal account. WeChat is the dominant messaging platform in China, and this library provides a Python interface to its web-based login, letting you write scripts that send and receive messages programmatically without touching the app manually. With a few lines of code you can log into WeChat by scanning a QR code, search your contacts by name or attributes like gender and city, send text messages or image and video files to friends or groups, and set up handlers that automatically respond when certain messages arrive. The library also supports creating group chats, inviting contacts into groups, forwarding messages across accounts or groups, and automatically accepting friend requests. The README describes common use cases including sending log output from other programs directly to your WeChat, building chatbots that hold conversations, controlling smart home devices that have open APIs, and pranking friends. The library is built on top of an earlier project called itchat and adds a cleaner object-oriented interface with multi-threaded message handling for faster responses. The project's README includes a notable warning: using a bot carries some risk that the account may be blocked from logging into the WeChat web client, though it does not affect the mobile app. The authors strongly recommend running bots on a secondary spare account rather than a primary one. The library supports Python 2.7 and Python 3.4 through 3.6 and can be installed via pip.

Copy-paste prompts

Prompt 1
Show me how to set up wxpy, log into WeChat via QR code scan, and send a text message to a contact using a Python script.
Prompt 2
How do I build an auto-responder in wxpy that replies to specific keywords in incoming WeChat messages?
Prompt 3
I want to forward my Python server's error logs to my WeChat using wxpy, show me the code to pipe log output into a WeChat message.
Prompt 4
Help me build a wxpy chatbot that listens for commands from my own WeChat account and executes Python functions in response.
Open on GitHub → Explain another repo

← youfou on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.