English | 简体中文
weflow is a Rust command-line version of the WeFlow backend. It reads, analyzes, and exports local WeChat chat history (WeChat 4.0 and later) right in the terminal.
- Prints human-readable text by default; add
--jsonto 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, andsql. Images, voice messages, videos, and stickers can be exported too. weflow serveprovides an HTTP API for every command and a web interface (WebUI).
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 --helpUninstall: make uninstall
weflow lang enFor language settings and precedence, see Command reference - Language on the Wiki.
Run PowerShell as administrator. WeChat 4.0 and later are supported. You need to have logged in to an account at least once, sent messages, and opened images.
- Set the WeChat data directory
weflow db detect
weflow config set db_path "C:\Users\<you>\Documents\xwechat_files"stdout:
db_path: C:\Users\<you>\Documents\xwechat_files
- Set your wxid
weflow db wxid
weflow config set wxid wxid_xxxxxxxxstdout:
wxid: wxid_xxxxxxxx
- Get and save the database key (details below)
weflow key db --savestdout:
Database key obtained and saved to the active profile
On Linux and macOS this step needs root: run sudo weflow key db --save (with the full path of weflow if sudo does not find it). Under sudo, WeFlow still uses your own config and gives the files it writes back to you; see Linux x64 in the Wiki.
- Get and save the image keys (Windows and Linux x64; on macOS, log in to WeChat, open a few images, then run
weflow key image-mem --save; see Image keys in the Wiki)
weflow key image --savestdout:
Image keys obtained and saved to the active profile
Without --save, the commands only print the keys; you can save them yourself with weflow config set.
- Check that the database opens
weflow db test- 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.htmlTo 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.
weflow config manages the configuration file.
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.
The WeFlow Rust CLI opens databases read-only and never modifies WeChat databases; commands that would modify a database are only placeholders. 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.
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.
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.
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.
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.
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.
The intellectual property rights of the WeFlow project belong to its developer, hicccc77. The Project is protected by copyright law, international copyright treaties, and other intellectual property laws and treaties. Users may download and use the Project provided that they comply with this statement and the relevant laws and regulations.
The right of final interpretation of the Project belongs to its developer, hicccc77. The Developer reserves the right to change or update this disclaimer at any time without notice.