Back up and read WeChat contacts

Suddenly it occurred to me — what if one day my WeChat account gets banned, causing me to lose all my contacts and bringing a lot of inconvenience? So today, I backed up my WeChat contact list. If I ever lose access to my account, I can still find my contacts through this backup file.

Backup Steps

  1. Use iTunes (now integrated into Finder under Devices) to create an unencrypted backup.
    The time needed depends on your device’s data size. My iPhone 14 Pro (256GB, used 149GB) took 35 minutes to back up.

  2. Use iPhone Backup Extractor in Expert Mode to extract the file
    Applications/com.tencent.xin/Documents/[MD5 of Your WeChat ID]/DB/WCDB_Contact.sqlite

  3. Open the extracted WCDB_Contact.sqlite file using DB Browser for SQLite.
    Select the Friend table, then from the menu, choose File → Export → Table(s) as CSV File…

Why Export as CSV?

Just take a look at how the data appears when opened directly with DB Browser for SQLite.
Many fields are of BLOB binary type, making it very unintuitive and inconvenient for reading and searching.

Especially the dbContactRemark field — it’s in a strange format, containing a mix of Unicode characters, nicknames, modified WeChat IDs, notes, pinyin, and more. When parsing, I needed to skip the [\u0000-\u001f] character set.

Parsing and Querying the Data in the .CSV

Parser ✈️ Go Now

Source code is here. Safe and open-source. Fully local parsing, so you can use it with confidence.

Once the .csv file is loaded, by default it filters out entries with type === 4 (i.e., people who are in the same group chat but not your friends).
If you want to view these, you can clone and run the project locally, and modify the filter condition in /src/index/index.tsx.

For ease of searching, the table displays four columns: avatar (dbContactHeadImage), WeChat ID (userName), WeChat Name (dbContactRemark), and Remark (dbContactRemark).
Click the ➕ symbol at the start of each row to expand and view the raw data.

The search box will match keywords from the userName and dbContactRemark fields.

Enum Values of the type Field in the Friend Table

These are results I obtained based on my own contact data, for reference only.

typemeaning
0WeChat Payment Assistant, Mini Program Merchant Helper
1Official Accounts, Moments, Friends
2WeChat Groups (not created by me), People Nearby, Shake
3Friends
4In the same group but not friends
5Friends added via shared contact cards
7Friends added from WeChat groups
8Blacklist
33QQ Mail Reminder
259,263Hide Moments from them
515Official Account
2049File Transfer Assistant
2050WeChat Groups I created
65537,65539,65543,
65795,66051,73729,
98307,98311
Don’t see their Moments
8388611,8388615,8388867,
8421379,8421635
Chat only
268435458WeChat Group
2147483649,2147483651Official Account

Reference

Data Backup Series (1): Backing Up WeChat Contacts