Preface¶
When running a WeChat Official Account, the typical workflow is: write the draft in Markdown locally, then copy it into the backend editor to adjust styles, upload images, and add a cover. Long-form articles and image carousels (multi-image horizontal scrolling) differ in APIs and fields, and manually switching between them can cause steps to be missed.
Below we introduce the WeChat Official Account – Article & Image Publishing skill on SkillHub (coordinate @user_dfcfbf47/weixin-publisher). On the Agent side it provides an executable publishing spec and scripts: it renders Markdown into WeChat-ready content and calls the draft API to write it, rather than assembling HTML ad-hoc in a chat.
What Is This¶
WeChat Official Account – Article & Image Publishing is a community-sourced (community) content-creation Skill maintained by publisher user_dfcfbf47, currently registered on SkillHub as version 1.0.1. Official entry points:
- API coordinate:
https://api.skillhub.cn/user_dfcfbf47/weixin-publisher - Display page:
https://www.skillhub.cn/skills/user_dfcfbf47/weixin-publisher
The brief matches the page: one-click publish Markdown to the WeChat Official Account draft box, supporting both article messages (long-form) and image messages (carousels). The SkillHub tag requires_api_key=true means you must configure the Official Account AppID / AppSecret before use (see the credentials file below).
Core Functions¶
Based on the SKILL.md and scripts in the Skill package, the verified capabilities are as follows.
Article Message (Long-form)¶
- Entry point:
scripts/publish.sh→scripts/publish_article.py. - Pipeline: Markdown parsing → theme CSS inlining → code highlighting → inline image upload and replacement → call
draft/addto create a draft; after publishing, self-checks are performed viadraft/countanddraft/get. - Dependencies: The article path primarily uses the Python 3.9+ standard library, without external layout CLIs.
- Optional features: Multiple layout themes and highlight themes, link-to-footnote conversion (external links in WeChat articles are easily filtered),
--render-onlyfor local-only preview, and inline SVG preprocessing viascripts/svg2wechat.py(SVG files cannot be uploaded directly in carousel mode).
Image Message (Carousel)¶
- Entry point:
scripts/wechat-image-post.py(requires requests to be installed). - Form:
article_type=newspic; the image list is passed viaimage_info;contentis a plain-text caption, not HTML. - Cover: The first image or the
coverfield in frontmatter; the script handles resizing (the cover must meet size limits, see the Skill doc’s error code table).
Credentials & Cache¶
- Credentials:
WECHAT_APP_ID,WECHAT_APP_SECRET, read by default from~/.wechat-credentials.env. You can specify another path with the environment variableWECHAT_CRED_FILE; alternatively,sourcethe Skill’sscripts/setup.shto load them. - Token & uploads: access_token is cached at
~/.config/wechat-publisher/token.json; image uploads are deduplicated by md5 at~/.config/wechat-publisher/upload-cache.json.
Installation & Activation¶
1. Install the SkillHub CLI (if not already installed)¶
Check or install the CLI per the SkillHub installation instructions:
command -v skillhub && skillhub --version
If not installed, run (full installation example):
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash
See https://skillhub.cn/install/skillhub.md for details.
2. Install this Skill¶
When installing, you must use --dir to point to your Agent’s current skills directory; otherwise it defaults to ./skills/ and may not be recognized.
skillhub install @user_dfcfbf47/weixin-publisher --dir <your skills directory>
Common paths (from the SkillHub installation doc):
- Cursor:
~/.cursor/skills/ - Claude Code:
~/.claude/skills/ - Codex:
~/.codex/skills/or.agents/skills/under the project
The SkillHub page also lets you hand the following prompt to an AI, which will complete the installation per the same documentation:
Please install `@user_dfcfbf47/weixin-publisher` according to https://skillhub.cn/install/skillhub.md.
After installation, @user_dfcfbf47/weixin-publisher will appear under the corresponding skills directory (containing SKILL.md and scripts/). To activate, have your Agent load this Skill and invoke the scripts per SKILL.md; after modifying Skill files you usually need to restart or re-load the Agent session.
3. Configure Official Account credentials¶
Create a credentials file on the machine running the publishing scripts (path is customizable; default shown below):
# ~/.wechat-credentials.env
export WECHAT_APP_ID=your_wechat_app_id
export WECHAT_APP_SECRET=your_wechat_app_secret
Load the environment variables before publishing, e.g.:
source ~/.wechat-credentials.env
# or: source <skill install dir>/scripts/setup.sh
You must also add the public IP of the machine running the scripts to the WeChat Official Account whitelist; otherwise the API may return 40164. The AppID / AppSecret are obtained from the Official Account backend under “Settings & Development → Basic Configuration” (the Skill’s README has corresponding instructions).
Typical Usage¶
In the paths below, replace <skill> with your local installation directory, e.g., under Cursor it’s often ~/.cursor/skills/@user_dfcfbf47/weixin-publisher.
Long-form article¶
- Prepare a Markdown file with frontmatter (
titlerequired;cover,description,author,themeoptional):
---
title: Article title (required)
cover: ./assets/cover.jpg
description: Article summary
author: Author name
theme: lapis
---
# Start of body
Your content, supporting Markdown syntax...
- Publish to the draft box:
source ~/.wechat-credentials.env
bash <skill>/scripts/publish.sh /path/to/article.md
Specify theme and highlight theme (second and third arguments):
bash <skill>/scripts/publish.sh /path/to/article.md lapis solarized-light
Render only, without calling the WeChat APIs:
python3 <skill>/scripts/publish_article.py /path/to/article.md \
--theme lapis --highlight github \
--render-only preview.html
The Skill package includes example.md, which can be used as a minimal integration sample:
bash <skill>/scripts/publish.sh <skill>/example.md
Image carousel¶
-
Fill in
title,cover, etc., in frontmatter per the Skill doc; the body is a plain-text caption plus![]()image references. -
After installing requests, run (the example matches the Skill doc and uses your local Python 3):
source ~/.wechat-credentials.env
pip install requests
python3 <skill>/scripts/wechat-image-post.py /path/to/post.md
After successful publishing, verify in the WeChat Official Account platform draft box; it does not auto-mass-send; you must still confirm and send manually in the backend.
Use Cases & Notes¶
Who it’s for
- Teams or individuals already writing in Skills-capable environments like Cursor, Claude Code, or Codex who want to codify “layout + image upload + draft creation” into a fixed scripted path.
- Those who need to cover both Official Account long-form and carousel draft types and want post-publish self-checks like
draft/getto reduce silent failures of “API succeeded but draft is wrong”.
Limitations & common pitfalls
- The target is only the draft box, not one-click mass-send to followers; you still need backend review and manual sending before going live.
- In carousel mode, the caption is plain text; do not treat it as HTML; URL-style content in captions may trigger errors like
45166(see theSKILL.mderror code table). - Uploading SVG files in carousel mode will fail; if using vector graphics in long-form, follow the docs to inline SVG or convert to bitmaps.
- The article and carousel paths have different Python dependencies: carousel requires
requests; when running in an isolated venv, use the interpreter path with the dependencies installed. - The public IP of the running environment must be in the whitelist; credential errors, expired tokens, cover size limits, etc., have corresponding error codes and suggestions in the Skill doc (e.g., delete
~/.config/wechat-publisher/token.jsonand retry).
SkillHub stats (at time of capture): rating 100000, about 1479 downloads; specific numbers are subject to the SkillHub page’s real-time display.
Conclusion¶
WeChat Official Account – Article & Image Publishing codifies the steps between Markdown drafting and the WeChat Official Account draft API into the Skill and scripts: long-form uses in-house rendering and theme inlining; carousels use the newspic multi-image structure; it emphasizes post-publish self-checks and ops details like credentials/IP whitelists. If you want stable draft output within your Agent workflow, install @user_dfcfbf47/weixin-publisher from SkillHub, configure credentials per the package’s SKILL.md, and try example.md first.
- Official API coordinate: https://api.skillhub.cn/user_dfcfbf47/weixin-publisher
- SkillHub page: https://www.skillhub.cn/skills/user_dfcfbf47/weixin-publisher