# pywechat for Windows WeChat UI Automation

> pywechat uses pywinauto and Windows UI Automation to control visible PC WeChat clients. The repository separates older WeChat support from its newer pyweixin module, making client and platform compatibility the main adoption constraint.

**Hello-Mr-Crab/pywechat** — 仍然可用的微信RPA！支持4.0系列微信pywechat是一个基于pywinauto实现的windows桌面微信自动化操作工具，基本实现了PC微信内置的各项操作。

- Repository: https://github.com/Hello-Mr-Crab/pywechat
- Stars: 2,093 · Forks: 545
- Language: Python
- License: NOASSERTION
- Published: 2026-10-16 · Updated: 2026-10-16 · Language: en
- Canonical page: https://hysenlabs.com/projects/hello-mr-crab-pywechat

## pywechat Controls Visible Windows WeChat Interfaces

pywechat addresses desktop automation for a visible PC WeChat client accessible through Windows UI Automation. It is built on pywinauto, and the README explicitly describes the approach as pure uiautomation without reverse-engineering hooks. Instead of modifying the client or intercepting internal calls, the library operates on controls exposed by the desktop interface. It is intended for Python developers who need to handle messages, inspect contacts, monitor chats, generate replies, or export data during an attended Windows session.

That boundary makes the intended user fairly specific. The machine must run Windows, the documented Python requirement is 3.10 or later, and the relevant WeChat account must have a usable visible UI. The README mentions OCR as another possible automation approach, but its examples remain based on UI Automation and pywinauto. pywechat is therefore not presented as a headless API client or a server-side WeChat transport.

Version compatibility requires particular attention. The README supports several Windows and WeChat versions at a project level, but it also says pywechat handles old WeChat clients and points users to README(3.9).MD for the relevant guide. Its more specific architecture note limits pywechat to 32-bit x86 Windows 7 or Windows 10. Current WeChat 4.1 examples belong to pyweixin, which the maintainers say they now primarily update. Choosing the module and matching client version is the first technical decision for an adopter.

## pywechat and pyweixin Cover Different WeChat Generations

Most examples in the current README import `pyweixin` classes, although the repository is named pywechat. The distinction is intentional. The README says pywechat supports older WeChat versions, directs users to README(3.9).MD, and states that pyweixin is maintained for WeChat 4.1 automation. The current examples therefore should not be treated as a pywechat 3.9 API without checking the older guide.

The environment section names WeChat 3.9.12.x and 4.1.6+, but the following architecture note narrows pywechat itself to old clients on 32-bit x86 Windows. This split can cause selector failures or import confusion if a developer follows the newest examples while operating the older client. The repository includes `README(3.9).MD`, `Weixin4.0.md`, `features_list.md`, `src/`, and separate pywechat and pyweixin manuals. That layout supports the conclusion that these are related but distinct automation paths.

The project also contains `Skill/` and `Mcp/` directories, but the README does not explain their exact relationship to the core package. They should not be assumed to provide a second installation route or a protocol-level interface. For a production design, the practical boundary is the one stated in the README: use pywechat with its documented old-client environment, and examine pyweixin when the target is WeChat 4.1.

## pywinauto Reads and Operates the WeChat UI Tree

The documented mechanism is Windows UI Automation through pywinauto. Utility functions generally receive a `main_window` or another pywinauto object, allowing code to locate interface controls and perform visible actions. `Navigator` opens WeChat interfaces, including separate chat windows, after which classes such as `Messages`, `Monitor`, and `AutoReply` can interact with those windows. The data flow is therefore based on rendered controls and their accessible properties, not a WeChat network protocol.

The multi-threaded monitoring example illustrates this architecture. It calls `Navigator.open_seperate_dialog_window` for each friend, retains the returned windows, and passes them to `Monitor.listen_on_chat` through `ThreadPoolExecutor`. Each listening operation then works against a desktop window object. This is useful for a person keeping WeChat open on a Windows workstation, but it does not create an independent messaging session that can run without the client interface.

UI Automation also creates direct dependencies on presentation state. Minimized windows, scroll position, control labels, interface language, and client rendering can affect whether expected elements appear in the UI tree. The README describes `maxPages=0` as a way to limit monitoring to the visible top area. It also calls a full-screen client with the target conversation pinned a stable arrangement. Those statements acknowledge the desktop-state constraints of this approach rather than promising control-tree stability across every WeChat build.

## pywechat Setup Starts with README(3.9).MD

The README states that Python 3.10 or later is required, but it does not give an exact installation command for pywechat. It links `QuickStart.md`, README(3.9).MD, `Weixin4.0.md`, and the operation manuals. Since the README does not state the package name, installation target, or dependency sequence, an exact `pip` command cannot be confirmed. Supplying one would risk installing pyweixin or an unrelated package.

For the first real use of pywechat, open README(3.9).MD and follow the procedure for the old WeChat client. Confirm that Windows and the WeChat process match the documented 32-bit x86 requirement. The account interface must also be visible and its controls must be exposed through UI Automation. The source under `src/` is relevant when confirming import paths after the version-specific setup.

The README does provide a basic information call for pyweixin. It is useful for confirming the newer module and client environment, but it is not a pywechat installation example:

```python
from pyweixin import Tools
print(Tools.about_weixin())
```

According to the README, this prints basic information about WeChat. Do not substitute `pyweixin` for pywechat unless the target is WeChat 4.1 and the older module is not required.

## Visible Sessions Support Messaging, Monitoring, and Export

The newer module examples document a broad set of desktop workflows, while still relying on the same UI Automation principle. `Messages` supports message sending, history retrieval, quoted replies, and chat export. `Contacts` exposes contact groups, and `Files` handles file sending and local chat-file export. `Monitor` listens for new messages, while `AutoReply` provides a basic callback-based implementation.

The public examples also cover client navigation, friend settings, and WeChat content. `Navigator` opens interfaces and separate conversations. `Moments` retrieves or publishes posts. `Collections` obtains official-account article links and saves notes as Markdown. `Tools` reports basic WeChat information and state. These classes operate through the desktop client rather than an independent backend service.

Several examples expose operational controls. `GlobalConfig` can adjust loading delays, maximization, and whether WeChat remains open. `Monitor.listen_on_newMessages` accepts a duration and page limit, while `maxPages=0` limits work to the visible top section. A quoted reply searches for original message text and may scroll through history. These details show that automation depends on deterministic window preparation and visible state.

Some capabilities have additional prerequisites. Voice sending in pyweixin requires WeChat 4.1.9 or later, a configured virtual driver, `sounddevice`, and `soundfile`. That feature should not be attributed to pywechat's documented 3.9 environment.

## Visible UI Rules Out Headless and Server Operation

The largest limitation follows directly from the architecture. pywechat requires a visible Windows desktop and controls exposed through UI Automation. It is unsuitable for macOS, Linux, a normal headless container, or a service that must continue while the WeChat window is unavailable. OCR may help with visible content that is difficult to access through controls, but the README does not document OCR as a complete pywechat workflow.

Client updates can also change selectors, labels, or the internal UI tree. A method that finds an unread badge, conversation, message, or Moments control can fail after WeChat changes how its desktop interface is rendered. The README does not publish selector mappings, version compatibility for every method, or a formal breaking-change policy for WeChat updates. Version-specific testing remains part of any adoption decision.

The README warns that `WeChatAppex.exe` must not be disabled for language detection because it affects official accounts, the built-in browser, and Channels. That is a concrete process dependency, not an optional performance tweak. The documentation also does not promise exactly-once message handling, idempotent actions, or crash recovery. pywechat is consequently a poor choice when deterministic server-side delivery is mandatory.

## Repository Activity Does Not Blur the Module Split

The repository is not archived, and its last push was on 2026-09-26. That confirms recent repository activity, but the README assigns current WeChat 4.1 development primarily to pyweixin. pywechat remains associated with an older 32-bit client environment. A recent push to the repository therefore does not mean that every pywechat method receives the same updates as pyweixin.

The repository metadata labels the licence as a custom licence that GitHub cannot classify. The `LICENSE` file must be reviewed before redistribution or commercial use because the source code itself does not establish permissions, attribution duties, or redistribution conditions. The README warns against illegal commercial activity and says consequences belong to the user. That warning is not a substitute for checking the licence text.

Migration from pywechat to WeChat 4.1 is more than a package update. The module, instructions, supported client, and platform boundary change. Code should be evaluated separately from pyweixin, and an existing automation should first be mapped against the specific methods it needs rather than assuming API continuity.

## pywechat Differs from Protocol-Based WeChat Clients

A real alternative is a protocol-level client or an official WeChat integration. Those approaches exchange structured requests and responses and do not depend on desktop controls, window focus, interface language, or accessibility-tree exposure. They are more suitable for server deployment and workflows that require centralized state management. They may have their own authentication and platform constraints, but their interaction model is fundamentally different from pywinauto automation.

pywechat instead automates the desktop client already visible to the user. That approach can work with the signed-in client without reverse-engineering hooks, but every operation remains tied to what the interface renders. It is better suited to attended desktop automation, prototypes, personal workflows, and environments where WeChat is deliberately kept open and visible.

OCR presents another partial alternative for visible text that is not exposed cleanly through UI Automation. The README acknowledges OCR as a separate strategy but does not supply a pywechat API for it. Adoption should therefore be based on the documented UI-tree approach rather than an assumed OCR fallback.

## Conclusion

Developers who need to automate a visible 32-bit Windows WeChat 3.9 client should inspect pywechat against README(3.9).MD and the custom LICENSE first. Projects targeting WeChat 4.1 should evaluate the separate pyweixin module instead. Do not adopt this repository for headless automation, macOS or Linux, unsupported WeChat builds, or use cases that prohibit desktop automation.

## FAQ

### Which WeChat versions does pywechat support?

The README says pywechat handles older WeChat versions and limits it to 32-bit x86 Windows. It points users to README(3.9).MD, while newer WeChat 4.1 work is associated with pyweixin.

### Does pywechat use reverse-engineering hooks?

No. The README describes pywechat as pure UI Automation based on pywinauto and says it does not involve reverse-engineering hooks. Automation still depends on a visible Windows WeChat interface.

### What operating system and Python version does pywechat require?

The README lists Windows 7, Windows 10, or Windows 11 with Python 3.10 or later. Its more specific note limits pywechat's older-client support to 32-bit x86 Windows 7 or Windows 10.

## Sources

- [Hello-Mr-Crab/pywechat on GitHub](https://github.com/Hello-Mr-Crab/pywechat)
- [Issues](https://github.com/Hello-Mr-Crab/pywechat/issues)
- [README](https://github.com/Hello-Mr-Crab/pywechat/blob/main/README.md)
- [Releases](https://github.com/Hello-Mr-Crab/pywechat/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/hello-mr-crab-pywechat
