跪拜 Guibai
← All articles
Frontend · CLI

Open-Source CLI Suite Automates WeChat Public Account Publishing End to End

By 阿康zz ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

WeChat publishing has long been a sink of manual drudgery, and this toolchain shows a concrete pattern for automating a closed-platform editorial flow while staying within official APIs. The proxy design is directly reusable by any developer who needs to call IP-whitelisted interfaces from a local machine or agent.

Summary

Publishing to WeChat public accounts forces creators through a batch of manual chores after the writing is done: pasting Markdown into a poor inline editor, cropping covers to two conflicting aspect ratios, and logging in and out of multiple accounts. A new open-source toolchain automates that whole flow. The core is zzhub-pipeline, a CLI task state machine that runs four stages in order: prepare, review, render, publish. It persists all state and artifacts locally, so a network timeout mid-run resumes from checkpoints instead of starting over.

The cover step is the trickiest. WeChat requires a 2.35:1 header image but center-crops it to 1:1 in feed cards, so a single image must keep text inside the square safe zone. The typeset-studio package handles this with pure algorithmic layout and native Canvas rendering, producing PNGs in milliseconds without spinning up headless Chrome. The author says this supersedes earlier attempts built on satori and satori-html, which proved too flexible for practical template use.

Safety is built in: the pipeline calls WeChat's official draft/add API, never scrapers. Because that API requires the caller's IP to be whitelisted, a lightweight proxy service, bun-wx-server, runs on a fixed-IP server. The pipeline only writes to drafts; the final broadcast requires a phone scan by the author. Multi-account switching works through per-account configuration, and the whole pipeline is agent-friendly.

Takeaways
— zzhub-pipeline runs four stages in a fixed sequence: prepare, review, render, publish, with local persistence enabling resumable runs after interruptions.
— Markdown is the only input format; the CLI archives referenced images and parses title, summary, and date automatically.
— AI-generated drafts start in an 'unchecked' state, locking cover generation and publishing until a cross-model review (a second model with a different architecture) or human sign-off passes them.
— typeset-studio renders cover images with pure algorithmic layout on native Canvas, no headless Chrome, while keeping all text inside the 1:1 square safe zone that also produces the 2.35:1 header image.
— WeChat's official API requires the calling server's IP to be whitelisted, so bun-wx-server proxies requests from a fixed-IP server to enable local CLI usage.
— The pipeline only saves to drafts; final public broadcast always requires a phone-scan confirmation by the author, preventing accidental mass sends.
— Multiple accounts are configured with aliases, and style/theme configurations attach per account for one-click distribution.
Conclusions

The review gate treats every AI draft as untrustworthy by default, forcing an independent model pass or human check. That's a pragmatic answer to hallucination risk when AI produces content destined for public distribution.

Moving from satori-style flexible templates to a fixed algorithmic layout suggests that too much template freedom was the bottleneck; constraining the layout while varying only text and images is what makes covers reproducible across posts.

The resumable state machine design borrows from CI/CD expectations, treating a publishing workflow as a long-running job that must survive partial failures rather than as a one-shot script.

Open-sourcing a proxy to work around WeChat's IP whitelist is a reminder that even official APIs on platforms like WeChat come with network constraints that force extra infrastructure when running locally.

Concepts & terms
Cross-model review
Using a second AI model with a different architecture to fact-check and proofread a draft written by another model, catching hallucinations and filler that the generating model might miss.
Safe area (cover image)
The central 1:1 region of a 2.35:1 cover image that must contain all text and important graphics, because WeChat center-crops that image to a square in its feed and chat cards.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗