How do I find worthwhile new articles when checking peer WeChat accounts each day?
To find new articles worth reading in peer WeChat accounts each day, request page one of each account’s article list with wechat_mp.v2.fetch_account_articles every day, and compare the returned articles with your saved records by account, app_msg_id and idx. Within one day’s scan, request the next page with the next_offset that the same scan returned; the next day, start on page one again. wechat_sync.py in step 8 writes the newly discovered articles to new-articles.csv and keeps the comparison state in state.json. Read article bodies only for the selected articles, with wechat_mp.v2.fetch_article_detail_h5. Share the discovered articles, the reason to read each one and the range you checked.
What does a daily check deliver?
For example, you check three pages and find a pricing announcement published today and an event notice from last month that your archive missed. Both articles go in new-articles.csv. In your review sheet, label the pricing announcement “Published today” and the event notice “Older article discovered today.” If the title of a known article changes, open the original article from changed-articles.csv and check what changed. Use the article key to link both CSV files to the source.
If the page budget ends at page three, report the three-page scope and the stop reason. On failure, keep the previous state and reuse the responses already saved. Use state.json for the next comparison, and keep reading decisions in a separate sheet. To schedule the check and notify a group, see the n8n and Feishu workflow.
1. Prepare the existing article table
Keep the account username, content tab, unique article key, title, URL, first-seen time and original response file for each article. Use a verified stable article ID or URL as the article key, not the title.
Call data:wechat_mp.v2.fetch_account_articles with an explicit raw:false. The documented simplified response contains data.biz_username, data.articles[], data.next_offset, and data.is_end (0/1). Each article has app_msg_id, idx, title, digest, url, create_time, and update_time. BeatAPI returns the simplified payload directly under data without remapping fields into another platform’s schema. The default raw=true response nests batch entries; do not feed a raw=true response into wechat_sync.py in step 8.
wechat_sync.py uses an account-scoped app_msg_id:idx key, so secondary articles in the same message stay separate. The table below lists local columns, not API output paths:
2. Inspect and bound the scan
Confirm the current inputs and price with the free Inspect request above. For a first run, limit the scan to one account, the article tab and at most three pages. Three pages is an example limit; three pages are not guaranteed to cover every account. Backfill older articles with the history guide.
3. Start every new scan at page one
Do not continue from the final cursor of an earlier history export to look for new posts. Omit offset in the first request:
Give each run its own directory. Keep the original responses, request IDs, timestamps and inputs, and do not overwrite earlier runs. Process records only after checking business success and the documented response mapping; a parsing error does not mean “no new articles.”
4. Compare keys and decide whether to continue
Map the returned articles into the local table and compare account plus article key with the history table. Add unseen keys, and update last_seen_at on existing keys. A changed title on an existing key is a modification, not a newly published article.
For the next page, pass the current run’s actual next_offset unchanged. Do not increment next_offset, and do not reuse next_offset across accounts or tabs. Track the cursors already used; stop and record the reason on a repeated cursor, a business error or the three-page limit.
Do not stop at the first old article. The fetch_account_articles contract does not guarantee strict chronological order, so new articles can appear after old ones. Reaching the scan limit does not mean the list is exhausted. To reduce omissions, widen the controlled lookback, scan more often or check deeper history periodically, and always report the range you actually checked.
5. Read bodies only for selected new articles
Review the list of newly discovered articles first, then call wechat_mp.v2.fetch_article_detail_h5 only for the URLs that need full text. Each detail read is charged separately; ten new articles in the list do not mean you should read all ten bodies.
Reuse saved text for the same article key where appropriate. Detecting edits needs a separate refresh policy: a key seen before does not prove the article content is unchanged. See Read article text.
6. Persist progress and recover before scheduling
Export each validated batch of saved pages into a new directory. If writing the local files fails, replay the saved JSON with key-based deduplication before buying another query. A failed run must not erase the previous successful history table.
Log the page count, new-key count, stop reason and original-response locations. An automated setup needs its own persistence, concurrency control and retry rules. An external scheduler triggers the runs, and writing to Feishu or a database is a separate integration. The steps on this page do not provide a built-in monitoring service.
7. Count calls and verify outcomes
P list pages plus N selected article-body reads take P + N platform queries. Price each action with a current Inspect request; later model analysis is billed separately. The list ignores page_size, so do not use page_size to estimate the record count.
Processing the same local response twice must add no duplicate articles. Test four cases: an old article followed by a new one, failed pages, repeated cursors and scan-limit termination. Failed pages, repeated cursors and scan-limit termination must never report “no updates today.” Check the scheduler and the destination writes separately.
wechat_sync.py in step 8 runs locally with no network calls and validates saved responses against the documented raw:false mapping.
Completeness and missed updates · Page sizes and content tabs · WeChat question index
8. Run the saved-page incremental processor
Pass wechat_sync.py the account’s canonical gh_ username, confirmed earlier from article detail. The API also accepts custom usernames, but wechat_sync.py requires the canonical username so that the response biz_username can be compared directly. Keep old state files unchanged as evidence. On the first run, pass - instead of a prior state file; the first run records only the observed pages, not a complete history. Before you call later additions “new,” import existing rows into the same account/app_msg_id/idx state format, or replay the saved simplified pages of the existing rows.
Save pages.json with the actual parameters, HTTP status, timestamp and relative response filename. The pages.json example below is a placeholder, not a recorded request. To collect pages, run the step 3 curl with --max-time 30 and -w '%{http_code}\n', and record the real status. A transport timeout is not an empty response and does not prove the request was free: keep the attempt and check usage before any retry.
Save the code below as wechat_sync.py. Initialize with python3 wechat_sync.py - pages.json scan-001. For the next daily scan, run python3 wechat_sync.py scan-001/state.json today-pages.json scan-002. Each daily scan starts with an empty offset, and each output directory must be new. wechat_sync.py never modifies the old state file, including on validation failure. wechat_sync.py processes at most three pages per scan and does not install a scheduler.
Deliver new-articles.csv for choosing body reads, and changed-articles.csv for known IDs whose list metadata changed. state.json is the input of the next scan. The raw publication and update values are kept separate from the first-seen and last-seen timestamps. IDs stay strings; import the ID columns as text in spreadsheets. Values that start with a formula character are escaped in the CSV files only; the original text stays in the observations and raw pages.
coverage.json records limits, errors and every source hash; observations.jsonl keeps repeated observations and the original objects. An old article followed by a new article is still processed. Two articles with the same app_msg_id but different idx stay separate. Replaying the same saved pages against the resulting output state produces no new IDs. Changed metadata does not show that the full body changed, and first discovery is not publication.
If the same scan needs another page, next-request.json contains the exact next_offset. Run the additional paid request only within budget, append the request’s actual log entry, and re-run the full expanded manifest against the same pre-scan state, not the interim output state, into another new directory. Re-running against the pre-scan state keeps the scan’s set of new items complete. Exact replay against an output state also works: a ledger of request ID, raw-byte hash, params and timestamp skips observations already applied and does not roll metadata back. wechat_sync.py rejects changed evidence for an already-processed request and older unseen requests. When the last page fails, the successful earlier pages are kept and marked gateway_failed; never report zero new items as “no updates anywhere.” A capped scan leaves older pages unchecked. Keep one writer per account: wechat_sync.py is not a concurrent database.
For ten accounts checked one page at a time, budget ten list calls. Add body reads for selected articles separately. Check current BeatAPI pricing before setting your schedule.
Identifier precision prerequisite
Unquoted JSON numbers decoded through float64 can lose precision above 9007199254740991 before wechat_sync.py reads the file. wechat_sync.py rejects any unquoted numeric ID above 9007199254740991, while IDs encoded as strings 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.
Hand selected articles to a knowledge base
Use the incremental workflow on this page to produce a sourced list of selected links. For a knowledge base that accepts article URLs, import one link first and check the imported title, source and folder. To prepare body files, follow article Markdown export. Record pending, imported and failed links separately, and retry only the failed links from the saved list. Use an import method you have verified in ima or your destination. The incremental result records which articles were discovered, not which were imported.

