# Wechat Mp Publisher

> Prepare blog posts or Markdown for WeChat Official Account, validate and preview WeChat-safe HTML, upload images, and create a draft through the official API. Use when the user asks to publish to 微信公众号, create a WeChat draft, adapt an article for 公众号, or check WeChat HTML compatibility.

- Skill: `nxxxsooo/wechat-mp-publisher` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx skillmds@latest add nxxxsooo/wechat-mp-publisher`
- Raw SKILL.md: https://api.skillmd.com/api/skills/nxxxsooo/wechat-mp-publisher/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: nxxxsooo (https://skillmd.com/u/nxxxsooo)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/nxxxsooo/wechat-mp-publisher

---


# WeChat MP Publisher

Prepare a reviewable WeChat Official Account draft. Keep credential handling, local rendering, remote draft creation, and final publishing as separate stages.

## Non-negotiable safety rules

- Never place an AppSecret, access token, AppID, account email, or secret-manager record in source files, Markdown, logs, screenshots, command arguments, or chat output.
- Read credentials at runtime from environment variables or the user's existing secret manager. Never invent a credential location.
- The npm CLI installs this skill and validates or previews HTML. It does not read credentials or call WeChat APIs. A preview may load already-uploaded HTTPS images from `mmbiz.qpic.cn`.
- Always run local validation and open the sandboxed local preview before any remote write.
- Ask for explicit approval after the preview is ready and before calling `draft/add`, even when the initial request says to publish immediately.
- Create a draft only. Never call a free-publish endpoint or bypass the user's final review in the WeChat admin console.
- Do not assume the account has a given API permission. Treat `48001` as a permission boundary, not as a reason to improvise another account or endpoint.

## Workflow

1. Identify the source article, target language, title, author, digest, canonical URL, article images, and cover image.
2. Read [references/setup.md](references/setup.md) before touching credentials or the API.
3. Adapt the article for a mobile feed. Preserve meaning, shorten dense paragraphs, remove site navigation, and keep headings and calls to action restrained.
4. Build one root `<section>` with inline styles. Read [references/html-compatibility.md](references/html-compatibility.md) before finalizing HTML.
5. Run:

   ```bash
   npx wechat-mp-publisher@2 validate article.html
   npx wechat-mp-publisher@2 preview article.html
   ```

6. Fix every validation error. Warnings require a conscious review.
7. Show the user the local preview URL and a compact summary of title, digest, image count, and any remaining warnings. Local-image warnings are acceptable only at this preview stage. Ask whether to upload materials and create the remote draft.
8. After approval, read [references/api-workflow.md](references/api-workflow.md), upload images, replace every local source, run `npx wechat-mp-publisher@2 validate article.html --final`, create the draft only when it passes, and check every JSON response for `errcode` before continuing.
9. Return the draft media ID and direct the user to review and publish manually in the WeChat admin console.

## Output contract

Before remote approval, return:

- final article HTML path;
- validation result;
- local preview URL;
- title, digest, canonical URL, and image count;
- one explicit approval question for draft creation.

After draft creation, return:

- draft media ID;
- account/API error details if creation failed;
- reminder that final publishing remains manual.

## References

- [references/setup.md](references/setup.md): account permissions, credentials, IP whitelist, and official docs.
- [references/html-compatibility.md](references/html-compatibility.md): conservative HTML and image rules.
- [references/local-preview.md](references/local-preview.md): CLI install, validation, preview, and troubleshooting.
- [references/api-workflow.md](references/api-workflow.md): stable token, image upload, cover media, draft creation, and error handling.

