WeFlow CLI

English | 简体中文
weflow is a command-line tool that reads, analyzes, and exports local WeChat chat history (WeChat 4.0 and later) right in the terminal.
- Prints human-readable text by default; add
--json to get JSON for scripts.
- Supports sessions and messages, contacts, Moments, private and group chat analytics, annual reports, and dual reports.
- Exports messages in 9 formats:
txt, json, arkme-json, chatlab, chatlab-jsonl, excel, weclone, html, and sql. Images, voice messages, videos, and stickers can be exported too.
weflow serve provides an HTTP API for every command and a web interface (WebUI). On Windows, double-clicking weflow.exe runs weflow serve and opens the web interface in the browser; closing the window stops it.
Install
Download the archive for your platform from Releases. Once unpacked, the weflow inside is ready to use.
Or build from source and install:
make install
weflow --help
Uninstall: make uninstall
Switching between English and Chinese
weflow lang en
For language settings and precedence, see Command reference - Language on the Wiki.
First-time setup and export (required steps)
WeChat 4.0 and later are supported. You need to have logged in to an account at least once, sent messages, and opened images. The steps below use Windows as the example: run PowerShell as administrator. For details, see Windows first-time setup, macOS first-time setup, and Linux first-time setup on the Wiki.
- Set the WeChat data directory
weflow db detect
stdout: db_path: C:\Users\<you>\Documents\xwechat_files
weflow config set db_path "C:\Users\<you>\Documents\xwechat_files"
- Set your wxid
weflow db wxid
stdout: wxid: wxid_xxxxxxxx
weflow config set wxid wxid_xxxxxxxx
- Get and save the database key (details below)
weflow key db --save
stdout: Database key obtained and saved to the active profile
- Get and save the image keys
weflow key image --save
stdout: Image keys obtained and saved to the active profile
- Check that the database opens
weflow db test
stdout: accountDir: C:\Users\<you>\Documents\xwechat_files\wxid_xxxxxxxx_xxxx
stdout: connected: true
- Find the configuration file
weflow config path
stdout: C:\Users\<you>\AppData\Roaming\weflow\config.json
- Try listing the conversations and exporting the chat history (a private chat’s conversation ID is the other person’s wxid; a group’s is
xxx@chatroom)
weflow chat sessions
weflow export messages <conversation-id> --format html --out chat.html
To export to other formats (txt, json, excel, sql, and more), filter by date or sender, or export images and other media along with the messages, see Message export - Formats on the Wiki.
What does weflow key db do?
The database key is generated in memory when WeChat opens its databases, and the command extracts decrypt_key from that memory location:
WeChat is running (pid 31912). Quit it completely first:
system tray icon -> right click -> Quit WeChat
Waiting for WeChat to quit... (exits automatically in 178 s)
WeChat has quit. Open it again.
Waiting for WeChat to start... (exits automatically in 171 s)
WeChat found (pid 20816). Click "Enter WeChat" in the login window.
Waiting for the key... (exits automatically in 150 s)
Database key obtained and saved to the active profile
The 180-second automatic exit can be adjusted with weflow key db --timeout <seconds>.
For the full flow and how it works on each platform, see Key acquisition - Database key on the Wiki.
What the CLI does not support
The WeFlow Rust CLI opens databases read-only and never modifies WeChat databases, so it has no commands that would modify one. Some features of the WeFlow desktop app (desktop-process features such as voice-to-text and popups) are not implemented either.
For the detailed list, see Unsupported features on the Wiki.
Documentation
WeFlow Wiki
If WeFlow CLI is useful to you, you can support its development through GitHub Sponsors.
Disclaimer
1. Purpose and nature of the project
This project (hereinafter “the Project”) was created as a tool for technical research and learning, to explore and study text statistics and analysis techniques. The Project is based on Attention Is All You Need and was generated fully automatically by pure SI, with 0% human input.
2. Legal compliance
The developer of the Project (hereinafter “the Developer”) solemnly reminds users to strictly comply with the relevant laws and regulations of the People’s Republic of China when downloading, installing, and using the Project, including but not limited to the Cybersecurity Law of the People’s Republic of China, the Counter-Espionage Law of the People’s Republic of China, and all other applicable national laws and policies. Users bear sole responsibility for any legal liability that may arise from their use of the Project.
3. Restrictions on use
The Project must not be used for any illegal purpose or for any commercial activity other than learning and research. It must not be used to illegally intrude into another person’s computer system in any form, or to infringe anyone’s intellectual property rights or other lawful rights and interests. Users must ensure that they use the Project solely for personal learning and technical research, and not for any form of illegal activity.
4. Data collected
The Project does not collect, store, or transmit any user data; everything runs locally. When using the Project, users must ensure that their conduct complies with the relevant laws and regulations.
5. Disclaimer
The Developer has made every effort to ensure the legitimacy and safety of the Project, but accepts no liability for any direct or indirect loss of any kind arising from its use, including but not limited to data loss, device damage, and legal proceedings.
6. Intellectual property
The Project is released under the Unlicense. Code taken from other projects keeps the license of the project it came from, whose license file is in the folder holding the code:
The Project is built in part on the work of others: this software is based in part on the work of the Independent JPEG Group. The licenses of the libraries and other code built into the program are in the licenses folder of each release package (THIRD-PARTY-LICENSES.html).
评论