Loading...
Loading...
This tool is designed for publishing HTML articles to WeChat Official Account drafts, especially when you need features like cover upload, automatic cover generation, body image URL replacement, CSS variable compatibility, or configuring draft metadata such as author and comment settings.
npx skill4agent add zhylq/yuan-skills zhy-wechat-publishbunNode.js >= 16bun.envWECHAT_APP_ID=Your Official Account AppID
WECHAT_APP_SECRET=Your Official Account AppSecret
WECHAT_DEFAULT_THUMB_MEDIA_ID=Default cover image media_id (optional)
WECHAT_DEFAULT_AUTHOR=AI Yuanlai Ruci (optional)zhy-article-illustratorSKILL.mdnpx skills add ... --skill zhy-wechat-publish.envscripts/| Script | Purpose |
|---|---|
| Upload article content to WeChat Official Account drafts |
| Upload local cover images to the permanent material library to obtain |
| Read articles, generate covers, upload covers, and push drafts |
ul/olthumb_media_idmedia_idnode scripts/wechat_draft.js --title "Article Title" --file "post.html" --author "AI Yuanlai Ruci" --thumb "MEDIA_ID" --need-open-comment "1" --only-fans-can-comment "1"| Parameter | Required | Description |
|---|---|---|
| Yes | Article title |
| Yes | Path to HTML article file |
| No | Author; if not provided, defaults to |
| No | Article abstract |
| No | Cover |
| No | Original article URL |
| No | Whether to enable comments, default is |
| No | Whether only fans can comment, default is |
node scripts/publish_with_cover.js --article "article.md" --html "post.html" --author "AI Yuanlai Ruci" --source-url "https://example.com"zhy-article-illustrator/scripts/image-gen.tsupload_image.js --jsonthumb_media_idwechat_draft.jsauthorthumb_media_idneed_open_comment=1only_fans_can_comment=1| Parameter | Description |
|---|---|
| Original article file, recommended Markdown, can also be HTML |
| Final HTML file to be uploaded to the Official Account |
| Explicitly override the title |
| Explicitly override the author |
| Custom cover output path |
| Cover aspect ratio, default is |
| Original article URL |
| Whether to enable comments, default is |
| Whether only fans can comment, default is |
wechat_draft.jsvar(--xxx)h1cgi-bin/media/uploadimg[40013] invalid appidWECHAT_APP_ID.env[40164] invalid ip... not in whitelist[40007] invalid media_idMissing Xiaomi/Gemini/OpenAI API Keymedia/uploadimg# Existing HTML, directly publish to draft
node scripts/wechat_draft.js --title "Tech Weekly" --file "post.html"
# Automatically generate cover and publish
node scripts/publish_with_cover.js --article "article.md" --html "post.html"
# Upload cover image and write media_id back to .env
node scripts/upload_image.js "cover.png" --write-env --json