wechat-publisher

Publish articles to WeChat Official Account (微信公众号) draft box via API. Use when the user wants to upload a Markdown article (with optional local images) to their WeChat 公众号 草稿箱. Handles token management, image uploading to WeChat CDN, Markdown-to-HTML conversion, and draft creation. Does NOT generate images — images must be provided as local files.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "wechat-publisher" with this command: npx skills add yuejiangli/wechat-official-account-publisher

WeChat Publisher Skill

Publish Markdown articles to WeChat Official Account draft box.

Prerequisites

  1. Create config.json in the skill root (copy from config.example.json), or set env vars WX_APPID / WX_APPSECRET (recommended for secrets).
  2. Python 3 available (python3)
  3. All scripts are in scripts/ relative to this SKILL.md

For full API details, read references/wechat_api.md.

Workflow

Step 1 — Gather inputs

Ask the user (or infer from context):

  • Article: path to .md file
  • Cover image (required): local image file for the article thumbnail (jpg/png, ≤1MB)
  • Body images (optional): local image files referenced in the article
  • Title: article title (use H1 from markdown if not specified)
  • Author (optional)
  • Digest/summary (optional, ≤120 chars)

Step 2 — Upload cover image → get thumb_media_id

THUMB_ID=$(python3 scripts/upload_thumb.py cover.jpg)

Step 3 — Upload body images → build image map

For each body image referenced in the article:

WX_URL=$(python3 scripts/upload_img.py images/fig1.png)

Build a JSON map of local filenames to WeChat CDN URLs:

{"fig1.png": "http://mmbiz.qpic.cn/...", "fig2.jpg": "http://..."}

Save as /tmp/image_map.json.

Skip this step if the article has no inline images.

Step 4 — Convert Markdown to HTML

# Without images:
python3 scripts/md_to_html.py article.md > /tmp/article.html

# With image map:
python3 scripts/md_to_html.py article.md --image-map /tmp/image_map.json > /tmp/article.html

Step 5 — Upload draft

python3 scripts/upload_draft.py \
  --title "文章标题" \
  --html /tmp/article.html \
  --thumb-media-id "$THUMB_ID" \
  --author "作者名" \
  --digest "文章摘要"

Output: media_id of the created draft.

The draft appears in the WeChat MP backend at: https://mp.weixin.qq.com → 草稿箱

Step 6 — Confirm

Tell the user:


Error Handling

ErrorFix
errcode: 40001Token expired → delete .token_cache.json and retry
errcode: 48001Account lacks API permission (check subscription vs service account)
errcode: 40007Invalid thumb_media_id → re-upload cover image
Cover upload failsImage must be jpg/png, ≤1MB

Notes

  • Access tokens are cached in .token_cache.json (auto-refreshed when expired)
  • WeChat only accepts images hosted on WeChat CDN — always upload images first
  • The draft is saved but NOT published; user must publish manually from MP backend or via /cgi-bin/freepublish/submit
  • Subscription accounts (订阅号) may have limited publishing frequency (once per day/week)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Leads

Leads - command-line tool for everyday use

Registry SourceRecently Updated
General

Bmi Calculator

BMI计算器。BMI计算、理想体重、健康计划、体重追踪、儿童BMI、结果解读。BMI calculator with ideal weight, health plan. BMI、体重、健康。

Registry SourceRecently Updated
General

Blood

Blood — a fast health & wellness tool. Log anything, find it later, export when needed.

Registry SourceRecently Updated
General

Better Genshin Impact

📦BetterGI · 更好的原神 - 自动拾取 | 自动剧情 | 全自动钓鱼(AI) | 全自动七圣召唤 | 自动伐木 | 自动刷本 | 自动采集/挖矿/锄地 | 一条龙 | 全连音游 - UI A better genshin impact, c#, auto-play-game, automatic, g...

Registry SourceRecently Updated