About baoyu-post-to-wechat
A skill for saving Markdown or HTML articles as drafts in WeChat Official Accounts from a local machine, aimed at publishers preparing articles. It handles the distinct upload steps for cover and inline images; it does not send mass messages.
Key features
- 01Accepts Markdown and HTML
- 02Converts Markdown to HTML
- 03Uploads inline article images
- 04Uploads a cover image
- 05Saves drafts through WeChat API
Use cases
- 01Saving an article draft from a local file
- 02Preparing posts with cover and inline images
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ tentacle-pro/ skills --skill baoyu-post-to-wechatAfter installing, type/baoyu-post-to-wechatin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/article-posting.mdimage-text-posting.mdscripts/cdp.tscheck-permissions.tscopy-to-clipboard.tsmd-to-wechat.tsscripts/md/cli.tsscripts/md/code-themes/1c-light.min.cssa11y-dark.min.cssa11y-light.min.cssagate.min.cssan-old-hope.min.cssandroidstudio.min.cssarduino-light.min.cssarta.min.cssascetic.min.cssatom-one-dark-reasonable.min.cssatom-one-dark.min.cssatom-one-light.min.cssbrown-paper.min.csscodepen-embed.min.csscolor-brewer.min.cssdark.min.cssdefault.min.cssdevibeans.min.cssdocco.min.cssfar.min.cssfelipec.min.cssfoundation.min.cssgithub-dark-dimmed.min.cssDetails
From the project READMEbaoyu-post-to-wechat (Community Edition)
Community edition posts directly to WeChat Official Account API from local machine.
Runtime
- Entry script:
scripts/wechat-api.ts - Run command:
bun .agents/skills/baoyu-post-to-wechat/scripts/wechat-api.ts <file> [options]
Credentials
Put credentials in shared .agents/skills/.env:
WECHAT_APP_ID=...
WECHAT_APP_SECRET=...
Resolution order:
- Process env
.agents/skills/.env
Scope
This skill only targets draft box saving (draft/add), not mass-send.
Publishing Rules
- Cover image uses permanent material API (
material/add_material, type=image), obtainsthumb_media_id. - Inline images in article HTML use
media/uploadimg, obtains publicurl. - Save draft through
draft/addwith article payload. need_open_comment=1,only_fans_can_comment=0by default.
Official API Mapping
draft/add(article_type=news):thumb_media_idmust be a permanentmedia_id.contentimage URLs must come frommedia/uploadimg.
material/add_material?type=image: cover and other permanent image assets.media/uploadimg: inline images for article HTML content.
Recommended Operation Order
- Normalize Obsidian image syntax (including
![[...]]) to standard markdown image form. - Render markdown to HTML.
- Upload inline images with
uploadimgand replace<img src>with returned URLs. - Upload cover with permanent material API and get
thumb_media_id. - Call
draft/add.
Input
.mdor.html- If input is markdown, script converts markdown first, then uploads inline images and publishes.
Examples
# Basic markdown draft publish
bun .agents/skills/baoyu-post-to-wechat/scripts/wechat-api.ts article.md
# Explicit cover and metadata
bun .agents/skills/baoyu-post-to-wechat/scripts/wechat-api.ts article.md \
--cover Assets/Cover-Images/my-topic/cover.jpg \
--title "标题" \
--author "作者" \
--summary "摘要"
# HTML input
bun .agents/skills/baoyu-post-to-wechat/scripts/wechat-api.ts article.html --cover Assets/cover.jpg
Notes
- WeChat requires inline article images to come from
uploadimgURLs. - Cover and inline image APIs are different and both are required for stable draft publishing.
Comments
Markdown supported