wechat-mp-publisher

Publish HTML content as WeChat draft posts via Python script.

1|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/yushuaibing9084-oss/wechat-mp-publisher --skill wechat-mp-publisher-yushuaibing9084-oss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wechat-mp-publisher
Source: https://github.com/yushuaibing9084-oss/wechat-mp-publisher/tree/main
Command: npx skills add https://github.com/yushuaibing9084-oss/wechat-mp-publisher --skill wechat-mp-publisher-yushuaibing9084-oss

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Publish WeChat official account drafts automatically by converting locally generated HTML content and images into a compliant WeChat draft, eliminating manual publishing steps and reducing errors.

Core Features & Use Cases

  • End-to-end automation: obtain access_token, upload images (including cover and article images), assemble inline-style HTML, and publish drafts to the draft box.
  • Reusable script: the scripts/publish.py is ready to run with environment variables configured for quick use.
  • Comprehensive API quick reference: includes token, material, and draft operations to simplify integration and troubleshooting.
  • WeChat HTML compatibility: enforce inline styles and allow only supported HTML elements to ensure consistent rendering.

Quick Start

Clone the repository, set WX_APPID, WX_APPSECRET and WX_IMG_DIR environment variables, then run python3 scripts/publish.py.

Frequently Asked Questions about wechat-mp-publisher

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate publishing HTML content as a WeChat Official Account draft?

Automating WeChat drafts requires setting WX_APPID, WX_APPSECRET, and WX_IMG_DIR environment variables, then executing the Python script to handle token retrieval, media uploads, and draft creation end-to-end.

How does the WeChat API handle inline-style HTML and image uploads for articles?

The WeChat API requires inline-style HTML for consistent rendering, and images must be uploaded as permanent material before being referenced in the article HTML to successfully create a draft.

Do I need Python 3.x and environment variables to use the WeChat draft publisher script?

Yes, you need Python 3.x installed and must configure WX_APPID, WX_APPSECRET, and WX_IMG_DIR environment variables to run the publish.py script and authenticate with WeChat APIs.

Why does my rich HTML content render incorrectly when pushed to the WeChat draft box?

Rich HTML renders incorrectly in WeChat if it contains unsupported elements or lacks inline styles, which are enforced by the publishing script to ensure compliant and consistent WeChat article rendering.

What is the best way to manage the WeChat access_token lifecycle for automated publishing?

The best way to manage the WeChat access_token lifecycle for automated publishing is using a reusable Python script that securely retrieves and handles tokens dynamically during the draft creation process.