← Back to Skills Marketplace
slientrain-new

Wechat Mp Editor

by slientRain-new · GitHub ↗ · v1.0.2 · MIT-0
cross-platform ⚠ suspicious
57
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install wechat-mp-editor
Description
Create, edit, and manage WeChat Official Account (公众号/服务号) articles via the official WeChat API. Handles access token management, image uploads, draft CRUD,...
README (SKILL.md)

WeChat MP Editor

Overview

Full workflow: credentials → access token → image upload → draft creation → publishing.

One fixed template — visual branding consistent. Only content (text, date, banner) changes.

Priority: Write from ideas queue first.


Ideas Queue (灵感队列)

File: skills/wechat-mp-editor/ideas-queue.json

Status: pending / writing / done / archived

FIFO by default, or ask user. Empty queue → scan ClawHub/GitHub Trending → propose 3-5 topics.


Prerequisites

Read before writing:

  1. references/templates.md — 唯一排版规范
  2. references/review-checklist.md — 发布前检查清单

严格规则

  • padding 全篇 20px
  • section 不嵌套
  • 含中文的 \x3Csection>\x3Cp>word-break:normal;white-space:normal
  • footer:padding:36px 20px 40px;text-align:center;
  • 品牌:巡梦人#bbb)+ 从一颗星星开始,温暖整个宇宙#aaa
  • 高亮:每 2-4 段一处 color:#d4a574

Workflow

0. Pre-writing

0.1 实体确认 — 同名产品/公司先确认目标实体。

0.2 信息收集 + 事实校验 — 两轮:广度收集 → 逐句核查论断性句子。

0.3 方向确认 — 输出 3-5 句 What/Why/How。用户确认后再写。如果中途文章结构发生重大变更(改比喻方向、替换方案、增加大段内容),重新输出方向确认,不可直接下笔。

1. Credentials

credentials/wechat-official.json:

{"name":"巡梦人","appId":"wx...","appSecret":"...","type":"wechat_mp"}

2. Get token

GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=***

Returns access_token, valid 2h.

3. Upload images

Body images (/cgi-bin/media/uploadimg):

curl -s -F "[email protected]" "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=***"

Returns {"url": "http://mmbiz.qpic.cn/..."}.

Cover image (/cgi-bin/material/add_material):

curl -s -F "[email protected]" "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=***&type=image"

Returns {"media_id": "..."}. 封面图必须 1:1 方形,否则报 53402。

4. Build HTML

Use references/templates.md. Fill in variables at marked locations.

5. Submit draft

编码规则(写死规则,不可违反)

requests 库的 json= 参数默认 ensure_ascii=True,会将中文转为 \uXXXX 转义码,微信编辑器显示为乱码。

禁止使用 requests.post(url, json=payload)

必须使用 以下两种方式之一:

方式 A(推荐):写文件 + curl

import json
with open('/tmp/draft.json', 'w', encoding='utf-8') as f:
    json.dump(payload, f, ensure_ascii=False)  # ensure_ascii=False 是必须的
curl -s -X POST "https://api.weixin.qq.com/cgi-bin/draft/add?access_token=***" \
  -H "Content-Type: application/json; charset=utf-8" \
  --data-binary @/tmp/draft.json

方式 B(仅没有 curl 时):

import json, requests
requests.post(url, data=json.dumps(payload, ensure_ascii=False).encode('utf-8'),
              headers={"Content-Type": "application/json"})

迭代规则

第一次创建用 draft/add。后续所有修改用 draft/update不要重复 add 制造新草稿

# 更新已有草稿
payload["media_id"] = "已有DRAFT_ID"
requests.post(".../draft/update?...", data=..., headers=...)

提交后立即回读验证

resp = requests.post(".../draft/get?...", json={"media_id": draft_id})
content = resp.json()["news_item"][0]["content"]

# 必须验证的内容
checks = {
    "title": "预期的标题",
    "已设置的中文摘要": True,
    "\\u": False,                # 必须为 False — 不得有转义码
    "[\u4e00-\u9fff]": True,    # 必须有真实中文字符
}

6. Publish

POST /cgi-bin/freepublish/submit with {"media_id": "DRAFT_ID"}.


HTML Content Rules

  • Inline CSS only, no \x3Cstyle> / \x3Cscript>
  • Images must be WeChat CDN URLs
  • Body 15px / headline 24px / quote 22px / small 11-13px
  • Line-height: body 2.0, cards 1.9
  • Mobile-first: paragraphs ≤ 2-3 lines on 375px viewport

配图(即梦 AI)

文章用图通过 即梦 AI 由用户生成。本 skill 仅负责:

  1. 确定每张图的叙事任务
  2. 调用 dreamina-cli 生成提示词
  3. 上传用户返回的图片到微信 CDN
  4. 嵌入 HTML

不自行写提示词格式,不维护提示词经验池。


发布前自检清单(十项全过才能提交)

□ 移动端:每段 ≤35 中文字符,特征卡 ≤20 字符
□ 移动端:特征卡间距正确(首 N-1 张 12px,末张 0px)
□ 移动端:连续正文不超过 3 段,需插入图片/分隔线/特征卡
□ 格式:分隔线全篇 padding 统一为 12px 20px
□ 格式:footer 颜色 品牌名 #bbb / 标语 #aaa
□ 格式:section 开闭数一致(\x3Csection> 数 = \x3C/section> 数)
□ 封面:media_id 已更换(非上次文章的残留 ID)
□ 编码:提交后回读验证 content 无 \uXXXX 转义
□ 编码:提交后回读验证 content 有真实中文字符
□ 摘要:digest 已设置且前 54 字不是 HTML 标签

References

  • references/templates.md — 排版规范
  • references/review-checklist.md — 检查清单
  • scripts/generate_images.py — 图片生成
Usage Guidance
Install only if you trust the publisher with your WeChat Official Account workflow. Use a dedicated least-privilege account or token if possible, keep app secrets out of plain files and logs, review every article and image before upload, and require explicit confirmation before draft updates or freepublish submission.
Capability Tags
cryptorequires-oauth-tokenrequires-sensitive-credentials
Capability Assessment
Purpose & Capability
The stated WeChat editor purpose matches token handling, image uploads, draft CRUD, and publishing, but those are high-impact actions on a live official account and the artifacts do not clearly require explicit user approval before each remote mutation or publish.
Instruction Scope
The workflow includes public publishing, draft updates, read-back verification, ClawHub/GitHub Trending topic discovery, and dreamina-cli image-prompt support; most is disclosed, but the scope is broad for a single editor skill and external discovery/CLI use is under-scoped.
Install Mechanism
No package install or persistence mechanism was found, but bundled executable Python scripts can perform WeChat API uploads and draft creation when invoked with a token.
Credentials
Local file reads/writes, temporary draft JSON files, and media uploads are generally proportionate to article publishing, but users should restrict inputs to intended article assets and avoid broad local paths.
Persistence & Privilege
The skill expects sensitive WeChat credentials and access tokens and can publish externally visible content; there is no strong documented token redaction, retention, or separate confirmation step for publishing.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install wechat-mp-editor
  3. After installation, invoke the skill by name or use /wechat-mp-editor
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.2
Added mobile viewport checks to templates.md checklist. Added ensure_ascii encoding rules to SKILL.md. Fixed draft update-vs-add iteration rules.
v1.0.1
Fixed: ensure_ascii=False encoding rule, draft update vs add rule, mobile viewport checks. Removed misleading Writing Style Guide section.
Metadata
Slug wechat-mp-editor
Version 1.0.2
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Wechat Mp Editor?

Create, edit, and manage WeChat Official Account (公众号/服务号) articles via the official WeChat API. Handles access token management, image uploads, draft CRUD,... It is an AI Agent Skill for Claude Code / OpenClaw, with 57 downloads so far.

How do I install Wechat Mp Editor?

Run "/install wechat-mp-editor" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Wechat Mp Editor free?

Yes, Wechat Mp Editor is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Wechat Mp Editor support?

Wechat Mp Editor is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Wechat Mp Editor?

It is built and maintained by slientRain-new (@slientrain-new); the current version is v1.0.2.

💬 Comments