wechat-article-publisher

Publishes Markdown files or webpage articles to WeChat Official Account drafts via API.

2.5k|134|Updated Jun 6, 2025
One-click install
npx skills add https://github.com/UnicomAI/wanwu --skill wechat-article-publisher
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wechat-article-publisher
Source: https://github.com/UnicomAI/wanwu/tree/main/configs/microservice/bff-service/configs/agent-skills/clawhub/wechat-article-publisher
Command: npx skills add https://github.com/UnicomAI/wanwu --skill wechat-article-publisher

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires requests, beautifulsoup4, markdown, pyyaml, Pillow, and includes scripts (resource) components.

What problem does it solve?

Manually converting Markdown articles or web pages into WeChat Official Account posts requires reformatting HTML, uploading cover images, and calling WeChat APIs by hand. This Skill automates the entire pipeline from content extraction to draft creation and optional publication.

Core Features & Use Cases

  • Content Extraction: Parses local Markdown files (with frontmatter support) or fetches and cleans article HTML from any http/https URL.
  • WeChat-Optimized Rendering: Applies standard or viral inline-styled templates, generates cover images with Pillow, and uploads them as WeChat media assets.
  • Draft & Publish API Integration: Creates drafts via the WeChat draft/add API, optionally submits freepublish requests, and queries publish status, returning JSON with draft_media_id and publish_id.
  • Use Case: A content operator runs the script with a blog URL and --dry-run to preview the styled HTML, then reruns with --publish to push the article live on the official account.

Quick Start

Fill in your WeChat app_id, app_secret, and author in config.json, then ask the assistant to publish a given Markdown file or article URL to your WeChat Official Account using the standard template with a dry-run preview first.

Frequently Asked Questions about wechat-article-publisher

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

FAQPage Schema
How do I publish a Markdown file to a WeChat Official Account?

Run scripts/publish_wechat.py with the Markdown file path as input after filling app_id, app_secret, and author in config.json. The script converts the Markdown to WeChat-styled HTML, uploads a cover image, and creates a draft via the WeChat draft/add API.

How to convert a webpage URL into a WeChat article draft?

Pass the http or https URL as the input argument to publish_wechat.py. The script fetches the page with requests, extracts the title and body using BeautifulSoup, rewrites relative links and images to absolute URLs, and submits the result as a draft.

Can I preview the WeChat article before publishing?

Yes, use the --dry-run flag to render the styled HTML without calling any WeChat API. The script writes a preview HTML file to the current directory and returns its path in the JSON output.

Why does WeChat draft creation fail with error 41005?

Error 41005 means media data is missing, typically because no cover image was uploaded. Provide a local image with --cover-image, ensure the article contains a downloadable image, or install Pillow so the script can auto-generate a cover.

What happens if the WeChat account lacks freepublish permission?

The --publish step returns error 48001 when the account lacks freepublish permission. The draft is still created successfully, so you can keep the draft_media_id and publish manually from the WeChat admin console.