mcpField
B
baoyu-post-to-wechat

baoyu-post-to-wechat

github.com/tentacle-proMarketing & growth494 installsUpdated 12w ago
Repository

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

  1. 01Accepts Markdown and HTML
  2. 02Converts Markdown to HTML
  3. 03Uploads inline article images
  4. 04Uploads a cover image
  5. 05Saves drafts through WeChat API

Use cases

  1. 01Saving an article draft from a local file
  2. 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-wechat

After 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.md
image-text-posting.md
scripts/
cdp.ts
check-permissions.ts
copy-to-clipboard.ts
md-to-wechat.ts
scripts/md/
cli.ts
scripts/md/code-themes/
1c-light.min.css
a11y-dark.min.css
a11y-light.min.css
agate.min.css
an-old-hope.min.css
androidstudio.min.css
arduino-light.min.css
arta.min.css
ascetic.min.css
atom-one-dark-reasonable.min.css
atom-one-dark.min.css
atom-one-light.min.css
brown-paper.min.css
codepen-embed.min.css
color-brewer.min.css
dark.min.css
default.min.css
devibeans.min.css
docco.min.css
far.min.css
felipec.min.css
foundation.min.css
github-dark-dimmed.min.css

Details

From the project README

baoyu-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:

  1. Process env
  2. .agents/skills/.env

Scope

This skill only targets draft box saving (draft/add), not mass-send.

Publishing Rules

  1. Cover image uses permanent material API (material/add_material, type=image), obtains thumb_media_id.
  2. Inline images in article HTML use media/uploadimg, obtains public url.
  3. Save draft through draft/add with article payload.
  4. need_open_comment=1, only_fans_can_comment=0 by default.

Official API Mapping

  • draft/add (article_type=news):
    • thumb_media_id must be a permanent media_id.
    • content image URLs must come from media/uploadimg.
  • material/add_material?type=image: cover and other permanent image assets.
  • media/uploadimg: inline images for article HTML content.

Recommended Operation Order

  1. Normalize Obsidian image syntax (including ![[...]]) to standard markdown image form.
  2. Render markdown to HTML.
  3. Upload inline images with uploadimg and replace <img src> with returned URLs.
  4. Upload cover with permanent material API and get thumb_media_id.
  5. Call draft/add.

Input

  • .md or .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 uploadimg URLs.
  • Cover and inline image APIs are different and both are required for stable draft publishing.

Comments

Markdown supported