← 返回
内容创作 Key

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 t...
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 t...
yuejiangli
内容创作 clawhub v0.1.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 496
下载
💾 6
安装
1
版本
#latest

概述

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:

  • ✅ Draft uploaded successfully
  • Draft media_id: XXX
  • View in WeChat MP backend: https://mp.weixin.qq.com (草稿箱)

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)

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-19 20:36 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

content-creation

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 41,084
content-creation

Humanizer

biostartechnology
消除AI写作痕迹,使文本更自然真实。基于维基百科"AI写作特征"指南,识别并修正夸张象征、宣传用语、肤浅-ing分析、模糊归因、破折号滥用、三项排比、AI词汇、负面平行结构及冗长连接词等模式。
★ 860 📥 199,942
content-creation

AdMapix

fly0pants
广告情报与应用数据分析助手,支持搜索广告素材、分析应用排名、下载量、收入及市场洞察,用于广告素材和竞品分析。
★ 295 📥 136,509