How do I organize an account's WeChat article history before choosing what to read?
To export a WeChat Official Account’s article history, call wechat_mp.v2.fetch_account_articles with the account’s verified username and raw=false. Each list page returns titles, summaries, links and publication times; pass each page’s next_offset back as offset for the next page, then turn the saved responses into a CSV with wechat_history.py below. If you only have an article link, the article-detail action data:wechat_mp.v2.fetch_article_detail_h5 returns the account ID in data.content.user_name.
For example, to find the account’s job announcements from last quarter:
- Build the article index back to the start of the quarter.
- Pick candidates by actual publication dates and titles.
- Open the selected articles to verify roles, deadlines and eligibility.
- Share the index, the dates you checked and the articles still to review.
Fetch article text, read counts or comments only for the selected articles.
A history backfill and a daily check start at different places. To resume a backfill, continue from the saved next_offset of the last saved page. To check tomorrow for new articles, start on page one and compare the page with your saved article keys. Daily update workflow
In the article index, keep each page’s request ID, and use each article’s original URL to link the index row to saved article details. The daily check uses the same account and the same article identities as the history backfill, and always starts from the first page.
Identify the account
The required username is an account identifier, not the account’s display name. Supported forms are gh_…, mini-program-linked gh_…@app, and custom WeChat IDs.
If you only have an article URL, inspect the article-detail action data:wechat_mp.v2.fetch_article_detail_h5 first. The article-detail output contract returns the account’s data.content.user_name; the article-detail call is an additional paid lookup, not free account resolution. Do not guess the account identifier from a translated display name.
Inspect the article-list action
Inspect is free. Use Inspect to check the inputs, readiness and price of wechat_mp.v2.fetch_account_articles. For the first page, omit offset or pass an empty string. offset is an opaque pagination cursor, not a row number or an article count.
Fetch one list page
Check the current pricing page, then replace <username> and run:
Check the HTTP status and execution status first. With explicit raw=false, the response returns data.articles[], data.biz_username, data.is_end (0/1), and data.next_offset. Each simplified article has app_msg_id, idx, title, digest, url, create_time, and update_time. The default raw=true returns nested batch objects instead. The saved-page incremental guide implements the simplified raw=false shape and state transitions; do not substitute another platform’s fields.
Pass back next_offset
Use the previous response’s next_offset as the next request’s offset, unchanged: do not decode or increment next_offset. Each page is another paid execution.
page_size appears in the input, but the public description says WeChat currently ignores page_size. Setting page_size to 100 does not guarantee one hundred articles, so never estimate collection size as calls multiplied by page_size.
Omitting item_show_type selects articles. Videos, audio and image-text posts are separate content tabs; for an article-history task keep the default instead of mixing tabs into one history.
Create a bounded incremental check
For a history backfill:
- Keep the raw responses, request IDs, account, content tab and page number.
- Use a verified stable article key for each article.
- Stop on a repeated cursor, an error or the approved page limit, and report the range you collected.
An unrecognized output field does not mean the history is exhausted.
A daily check is a separate task: request the first page again and compare the first page against the saved keys. The incremental sync guide covers deduplication, recovery and scheduling. The list has no ordering guarantee, so do not stop at the first old article.
Build an article directory for the username I provide. Check the first page’s account identity, then continue within the chosen date range and budget. Save titles, links, publication times, raw responses and request IDs. Retrieve bodies after I select articles, and report the actual scope and request count when finished.
Cost and next step
Article-list pages and article details are separate executions. Select relevant entries from the article index first, then fetch full text only for the selected articles. The article index does not guarantee complete history or real-time updates.
Social Data contract · Capabilities contract
Save a resumable history chunk, then hand its state to daily checks
A history backfill uses the same documented raw=false fields as the incremental processor, but each chunk continues the current history cursor instead of starting at page one. The wechat_history.py helper below processes saved responses only. wechat_history.py does not execute a paid request and does not retry an error.
- Prepare
history-pages.jsonfrom 1–20 saved pages in the order you collected them. Each entry records the action, the params (canonicalgh_username,raw=false,item_show_type=0, andoffsetonly when continuing), the HTTP status, the collection time, and the response filename. The manifest format is the same as in the incremental guide. Every next page must use the exact precedingdata.next_offset. The 20-page limit is a local chunk cap, not a platform page limit or a fixed article count. - Save the script as
wechat_history.pyand run the first chunk:python3 wechat_history.py - history-pages.json history-001. wechat_history.pywrites the first request of the next chunk tohistory-001/next-request.json. Collect the next pages within your approved budget, save their log, then runpython3 wechat_history.py history-001 next-pages.json history-002.- Keep all chunk directories:
state.jsonholds the current article table, and the earlier raw evidence stays in the earlier chunk directories.
checkpoint.json records the next parameters, the previous chunk, the ledger of seen cursors and the stop reason. The cursor ledger catches a cursor that returns itself and a cursor cycle across different chunks; the explicit --restart flag begins a new cursor sequence. Read the stop reasons as follows:
The exported coverage.json never labels the archive “complete history.”
On a gateway failure, wechat_history.py keeps the successfully parsed preceding pages, and checkpoint.json keeps the failed request’s exact params. The saved params are a recovery proposal, not an automatic retry and not a guarantee of no charge. Check the error and usage, and approve any additional spending before running the request again. Handle a network timeout that has no saved error body outside the parser; never invent a successful or empty page.
If the platform rejects an old cursor:
- Send a fresh page-one request with
raw=falseand save the actual response and log. - Run
python3 wechat_history.py history-002 restart-pages.json history-003 --restart.
The restart keeps existing article identities and first-seen times and resets only the pagination position; the restart does not erase old history or reuse the rejected cursor. Replays of already processed requests are still hash-checked. A changed title for an existing article key is tracked as a changed article, separately from a new article.
For daily checks, switch to python3 wechat_sync.py history-003/state.json today-pages.json daily-001 from the incremental guide. The first daily request omits offset; the daily check does not continue checkpoint.json. Keep the history coverage status next to the daily report, especially if you stopped the initial backfill at a budget cap. Select only specific new URLs for separately billed body reads. Raw time values stay raw; first-seen time is not publication time.
Estimate list cost as planned pages multiplied by the current list price on the pricing page. wechat_history.py processes up to 20 saved pages per chunk and makes no retrieval requests; continue with another chunk for a larger history. Record each chunk’s actual scope and stop reason for the next continuation.
Identifier precision prerequisite
Unquoted JSON numbers decoded through float64 can lose precision above 9007199254740991 before wechat_history.py reads the file. wechat_history.py rejects any unquoted numeric ID above 9007199254740991. IDs encoded as strings in the response stay exact. Do not “fix” a rejected numeric ID by wrapping the rounded value in quotes: stop the export and keep request_id for investigation. Python’s large integers and spreadsheet text formatting cannot restore digits already rounded during JSON decoding.
Apply the same checkpoint rules to one other content tab
wechat_history.py accepts an explicit item_show_type of 0 (articles), 5 (videos), 7 (audio), or 8 (image-text). wechat_history.py reads the tab from the first recorded request and locks that tab for the manifest, stored state, continuation, and restart. Keep a separate chunk chain per account and tab. Existing article-tab state stays compatible, but article-tab state cannot seed a video run. The daily-sync helper wechat_sync.py still accepts article tab 0 only.
The output files keep the historical names new-articles.csv, changed-articles.csv, and state.articles for compatibility. For a nonzero tab, those rows hold the tab’s returned post metadata rather than classic article bodies. The original item objects, including item_show_type, msg_type, and cover, stay in observations.jsonl and the raw page files. Do not infer a downloadable video or audio asset from a post URL, and do not count cover images as all images in a post. Nonzero content tabs follow the same manifest tab-locking and continuation rules in wechat_history.py; verify the returned item structure against your first saved media-tab response.
For an editorial subset, filter by within-batch headline position, not by page order or app_msg_id alone.

