← Back to Skills Marketplace
aiworkskills

公众号草稿 / 发布(微信 API)

by marsatwechat · GitHub ↗ · v1.0.22 · MIT-0
cross-platform ✓ Security Clean
187
Downloads
1
Stars
1
Active Installs
10
Versions
Install in OpenClaw
/install aws-wechat-article-publish
Description
公众号发布|公众号草稿箱|公众号群发|图文推送|微信 API|wechat automation|WeChat API automation|auto publish|scheduled publish — 公众号 API 发布工具,图文入草稿箱或直接群发,支持封面素材上传、发布前检查与 draft/publis...
README (SKILL.md)

发布

公众号 API 直连发布 —— 图文入草稿箱或直接群发,素材上传、发布前检查一站式完成。

套件说明 · 本 skill 属 aws-wechat-article-* 一条龙套件(共 9 个 slug,入口 aws-wechat-article-main)。跨 skill 的相对引用依赖同一 skills/ 目录,建议一并 clawhub install 全套。源码:\x3Chttps://github.com/aiworkskills/wechat-article-skills>

能力披露(Capabilities)

本 skill 调 publish.py 直连微信公众号官方 API 发布图文。会把本篇 article.htmlimgs/* 文件作为 POST body 上传到微信服务器。 具体行为:

  • 凭证读取aws.envWECHAT_{N}_APPID / WECHAT_{N}_APPSECRET(多槽位支持 N≥1)
  • 凭证外发APPID / APPSECRET 以 query string 形式发给 api.weixin.qq.com/cgi-bin/tokenaccess_token;后续请求带 access_token query string。微信返回的 access_token 在进程内存短期缓存,不落盘
  • 内容外发:本篇封面、正文插图以 multipart upload 发给 material/add_materialarticle.html 正文与标题/摘要以 JSON POST 发给 draft/addfreepublish/submit
  • 网络目标:默认 api.weixin.qq.com;用户可在 WECHAT_{N}_API_BASE / config.yaml.wechat_api_base 自配反代
  • 文件读:仓库内 .aws-article/config.yamlaws.env、本篇 article.yamlarticle.htmlimgs/*
  • 文件写:仅本篇 article.yaml 的状态字段(media_idpublish_idpublish_completed
  • shell:仅 python3 {baseDir}/scripts/publish.pygetdraft.pyarticle_init.py

建议:首次运行用 publish_method: draft 只入草稿箱确认效果,再切 published 真正群发。

配套 skill(informational)

本 skill 是 aws-wechat-article-* 一条龙公众号套件的发布环节(入口 aws-wechat-article-main)。工作流中的若干步骤会读取同级 ../aws-wechat-article-main/references/*.md 等共享文档(首次引导、articlescreening schema、env/config 示例等)。

  • 套件完整装齐到同一 skills/ 根目录时,跨 skill 引用都能读到。
  • 单独安装本 skill 时,跨 skill 引用的步骤会在读取阶段遇到 file not found;但 publish.pygetdraft.pyarticle_init.py 这几个脚本本身可独立运行(只要 aws.env.aws-article/config.yaml 就绪)。

完整 9 slug 清单见 源码仓库

通过微信公众号 API 将排版稿写入草稿箱或再提交发布(由 config.yamlpublish_method 与命令行 --publish 控制)。

配置检查 ⛔

任何操作执行前,必须首次引导 执行其中的 「检测顺序」。检测通过后才能进行以下操作(或用户明确书面确认「本次不检查」):

脚本目录

Agent 执行:确定本 SKILL.md 所在目录为 {baseDir}。发布子命令在 {baseDir}/scripts/publish.py(项目根执行)。

脚本 / 子命令 用途
article_init.py 初始化或更新本篇 article.yaml(及可选 closing.md)。用于总览 本篇准备(建目录后)或 发布前 补全元数据。仓库根执行:python {baseDir}/scripts/article_init.py \x3C文章目录> [--title … --author … --digest …]
getdraft.py 独立于 publish.py:用于正式文章查询(published-list / published-fields / publish-get / article-get,对应 freepublish/*),可用于 embeds.related_articles.manual 为空时自动补全推荐链接。注意:freepublish/* 需要公众号具备对应接口权限。仓库根:python {baseDir}/scripts/getdraft.py published-fields
check-screening 校验 config.yamlpublish_methoddraft / published / none
check-wechat-env config.yaml 槽位检查 aws.envWECHAT_N_APPID / WECHAT_N_APPSECRET 是否已填(调用 publish.py 前建议跑
check 环境检查:aws.env、各槽位、依赖、可选探测 token
accounts 列出 config.yaml 中各微信槽位名称,并标记 aws.env 凭证缺项
full / token / … 调微信 API(需 aws.env 微信凭证)

凭证与 publish_method

publish_method(以仓库 config.yaml 为准)

含义 行为
draft(默认) 只进公众号草稿箱 full 创建草稿后调用 freepublish 提交发布。
published 草稿 + 提交发布 full 创建草稿后继续提交发布(异步)。full --publish单次强制带发布,即使当前为 draft
none 用户明确不填微信 full 立即退出,不调任何微信接口(--publish 也会被忽略)。其它子命令(token 等)仍要凭证。

多账号时如何选槽位

  1. 运行 python {baseDir}/scripts/publish.py accounts,从 config.yamlwechat_accounts + wechat_N_name 向用户展示列表(例如:您有2个账号:1."xiaoming",2."xiaoz")必须询问用户选择哪个账号发布到草稿箱,然后根据用户选择发布到指定的账号。
  2. config.yamlwechat_publish_slot: \x3C整数>命令行 --account \x3C序号或名称>CLI 优先,见 articlescreening-schema.md)。

全局环境

在仓库根具备 aws.env(微信密钥)与 config.yaml(微信槽位数量与名称)。写作/生图见 validate_env.py(微信未齐仍可先做内容)。publish_method: nonefull 会跳过;draft/published 发布前建议 check-wechat-env。API 端点优先取 WECHAT_N_API_BASE,若槽位未配则回退 config.yaml.wechat_api_base(两者都空时使用官方)。

作者名回退

full / create-draftarticle.yaml 无 author,回退 config.yamldefault_author

publish_completed(本篇是否已发布完成)

  • 字段在本篇 article.yamlpublish.py 不读、不改;由智能体维护。
  • false:发布流程未闭环。
  • true:已视为发布完成(草稿已确认 / 或 published 流程成功且运营确认)。

本篇发布真正结束后:将 publish_completed: true 写回 article.yaml

写回 true 的前置门禁(缺啥补啥)

  1. article.html 存在;
  2. 文章目录存在封面图 cover.(png/jpg/jpeg/webp)
  3. article.mdarticle.html 中均不含 placeholder
  4. 发布命令成功并拿到回执(media_idpublish_id)。

任一不满足:只可标记为“已提交草稿,未闭环”,不得写回 publish_completed: true

用户仅说「发布」且未明确路径时 ⛔

在用户未给出 drafts/… 路径、仅说「发布文章」「帮我发一下」等时:

  1. 确定本篇目录:列出仓库下 drafts/ 中子目录;若多篇,请用户指定一篇或选「最新修改」的一篇再读该目录 article.yaml在未确认目录时假定路径。
  2. 读取该目录 article.yaml 中的 publish_completed(YAML 布尔:true / false缺省按 false 处理)。
publish_completed 智能体对用户说明(可略作口语化,勿改含义)
true 告知:项目里本篇文档已按记录成功发布;问:您是否需要编写新文章? 若需要 → 转交 main / writing 从本篇准备或选题起走。
false 或缺省 读取 article.yamltitle(若无则用目录名简述),说明:《{title}》尚未执行完成(发布流程未闭环);问:是否需要继续并完成发布?编写新文章? 若继续本篇 → 再核对 config.yamlpublish_methodcheck-screeningcheck-wechat-env 等。

工作流

发布进度:
- [ ] 前置:配置检查(见本节「配置检查」)⛔
- [ ] 第0步:若用户未给路径 → 选本篇目录 → 读 publish_completed → 按上表分流(true/false)
- [ ] 第1步:读 **`config.yaml`** → **`draft` / `published`**(及是否 **`full --publish`**)
- [ ] 第2步:读取 **`config.yaml`** 的 `wechat_accounts` + `wechat_N_name` 向用户展示账号列表并询问目标槽位;随后跑 **`check-wechat-env`** 校验 `aws.env` 凭证 → **`wechat_publish_slot` 或 `--account`**
- [ ] 第3步:发布前检查(checklist + **`check-screening`** + **`check`**)
- [ ] 第4步:准备文章目录
- [ ] 第5步:**`full`**(仅草稿或含发布,视上步)
- [ ] 第6步:确认结果与用户说明
- [ ] 第7步:成功后写回 **`article.yaml`** 的 **`publish_completed: true`**;按需归档

交互顺序(最小提问)

  1. 未给路径时:先按上文 「用户仅说发布」 处理 publish_completed;用户选 继续本篇 后再做下列步骤。
  2. 先看 config.yamlpublish_methoddraft = 默认只进草稿箱;publishedfull --publish = 再提交发布。
  3. 多槽位:展示账号列表(来源:config.yamlwechat_accounts + wechat_N_name),必须请用户选槽位wechat_publish_slot--account
  4. 缺微信字段:运行 check-wechat-env,补全 aws.env 后再发。
  5. 发布失败(由脚本 stderr / 微信 errcode 判断):
    • 网络类(超时、连接失败、5xx):脚本已对单次请求 自动重试 1 次;仍失败 → 告知「网络不可用,请稍后重试或检查代理」。
    • 凭证/配置类(如 token 失败带 errcode、缺字段)→ 提示 第几槽位、检查 APPID/SECRET、IP 白名单,用户改正后再执行 full / publish
  6. 中间产物缺失(封面缺失 / 存在 placeholder):先补产物再发;若用户坚持先发草稿,必须明确告知“正文配图未完成”,且保持 publish_completed: false

命令示例(仓库根)

python {baseDir}/scripts/publish.py check-screening
python {baseDir}/scripts/publish.py check-wechat-env
python {baseDir}/scripts/publish.py accounts
python {baseDir}/scripts/publish.py check
python {baseDir}/scripts/publish.py --account 1 full drafts/YYYYMMDD-标题slug/
python {baseDir}/scripts/getdraft.py published-fields

详见 references/usage.mdreferences/submit-guide.mdreferences/api-reference.md

过程文件

读取 产出
article.htmlimgs/article.yaml(含 publish_completed 等)、.aws-article/config.yamlaws.env(微信槽位) 发布到公众号草稿或提交发布;成功后由智能体将 publish_completed: true 写回 article.yamlpublish.py 不改此键)
Usage Guidance
This skill appears to do exactly what it says: it reads article files and a local aws.env containing your WeChat AppID/AppSecret and calls the WeChat API to upload images and create/submit drafts. Before installing or running: (1) store aws.env securely (do not commit real secrets to git), (2) run first in publish_method: draft mode to verify behavior, (3) confirm WECHAT_N_API_BASE is not pointed to an unexpected host (it may be customized to a proxy), (4) run the scripts in a controlled environment with PyYAML/Pillow installed as needed, and (5) review aws.env and .aws-article/config.yaml contents if you plan to use multiple accounts. If any of the above seems unexpected for your use case, inspect the scripts in this package and test with non-production credentials first.
Capability Analysis
Type: OpenClaw Skill Name: aws-wechat-article-publish Version: 1.0.22 The skill bundle provides a legitimate set of tools for automating article publishing to WeChat Official Accounts via official APIs. It includes scripts for metadata management (article_init.py), draft retrieval (getdraft.py), and a full publishing workflow (publish.py) that handles image compression and multi-account support. While the skill requires access to sensitive credentials (WECHAT_APPID/SECRET) and network permissions, these are used exclusively for interacting with the WeChat API (api.weixin.qq.com) as described. The SKILL.md instructions define a structured workflow with mandatory environment checks and user confirmations, showing no signs of malicious intent or prompt injection.
Capability Tags
requires-sensitive-credentials
Capability Assessment
Purpose & Capability
Name/description promise direct WeChat publishing; scripts (publish.py, getdraft.py, article_init.py) implement token retrieval, image upload, draft creation and publish flows and read/write article files. Required binaries (python3) and env secrets (WECHAT_?_APPID/APPSECRET in aws.env) match the purpose.
Instruction Scope
SKILL.md explicitly instructs reading repository files (.aws-article/config.yaml, aws.env, article.yaml, article.html, imgs/*) and running the included Python scripts. These actions are necessary for the described publish workflow and the instructions constrain path discovery (ask user to pick article dir) rather than doing broad scans.
Install Mechanism
No install spec or external downloads; this is an instruction+script skill relying on existing python3 and optional PyPI libs (PyYAML, Pillow). No remote code fetch or archive extraction is performed by the skill.
Credentials
The skill requires WeChat credentials (WECHAT_1_APPID, WECHAT_1_APPSECRET) stored in the declared primaryEnv (aws.env) which is expected. Note: scripts support multiple WECHAT_N slots and optional WECHAT_N_API_BASE overrides; metadata only enumerates the first slot, so if you plan multi-account use you must provide matching entries in aws.env/config.yaml.
Persistence & Privilege
always:false and no modification of other skills or global agent settings. The skill needs filesystem, network, and shell permissions (to run Python scripts and perform HTTP calls) which are proportional to its functionality.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install aws-wechat-article-publish
  3. After installation, invoke the skill by name or use /aws-wechat-article-publish
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.22
软化版套件完整性提示:说明工作流会读跨 skill 共享文档、单独安装时会 file-not-found;纯信息性语气,无 shell 循环、无 Agent 强指令
v1.0.20
修 scanner 精准点名:移除'不外传/不读仓库外'假陈述;补凭证/内容外发披露;sticker+review 补 WECHAT 凭证声明;空 env 的 skill 移除 primaryEnv;3 个脚本不再遍历父目录
v1.0.19
能力披露:frontmatter 加 metadata.openclaw.requires;body 加 Capabilities 段;降温前置依赖块(去 shell 循环与强指令语气);article_init.py 不再读 Path.home()
v1.0.18
清理 tags 只留 latest;frontmatter 加 homepage+url;main/publish 加 automation 关键词
v1.0.17
加前置依赖检查:任一 skill 启动前要求 9 个套件全装,否则停止工作流
v1.0.16
压缩 description 做 SEO 密度优化
v1.0.15
SEO 优化:补关键词/友好名/价值主张/GitHub 链接
v1.0.14
对齐 git tag v1.0.14
v1.0.1
首发/补套件说明:跨 skill 相对引用需同 skills/ 目录一起安装
v1.0.0
- Initial release of the AWS WeChat article publishing skill. - Supports publishing articles to WeChat Official Accounts via API (draft or published), with pre-publish checks. - Guides account selection and configuration validation, including multi-account support and credential checks. - Handles article status tracking via article.yaml (`publish_completed: true/false`) for workflow management. - Provides robust error handling, directory structure guidance, and step-by-step user interaction flow. - Includes CLI scripts for publishing, environment validation, and account management.
Metadata
Slug aws-wechat-article-publish
Version 1.0.22
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 10
Frequently Asked Questions

What is 公众号草稿 / 发布(微信 API)?

公众号发布|公众号草稿箱|公众号群发|图文推送|微信 API|wechat automation|WeChat API automation|auto publish|scheduled publish — 公众号 API 发布工具,图文入草稿箱或直接群发,支持封面素材上传、发布前检查与 draft/publis... It is an AI Agent Skill for Claude Code / OpenClaw, with 187 downloads so far.

How do I install 公众号草稿 / 发布(微信 API)?

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

Is 公众号草稿 / 发布(微信 API) free?

Yes, 公众号草稿 / 发布(微信 API) is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 公众号草稿 / 发布(微信 API) support?

公众号草稿 / 发布(微信 API) is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 公众号草稿 / 发布(微信 API)?

It is built and maintained by marsatwechat (@aiworkskills); the current version is v1.0.22.

💬 Comments