channel

WeChat Official Account Draft Box management tool. Create and manage graphic draft articles via WeChat API, supporting text and images. Automatically extracts the first paragraph as summary. Supports draft creation, listing, publishing, and deletion.

3,891 stars

Best use case

channel is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

WeChat Official Account Draft Box management tool. Create and manage graphic draft articles via WeChat API, supporting text and images. Automatically extracts the first paragraph as summary. Supports draft creation, listing, publishing, and deletion.

Teams using channel should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/channel/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/alphafactor/channel/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/channel/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How channel Compares

Feature / AgentchannelStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

WeChat Official Account Draft Box management tool. Create and manage graphic draft articles via WeChat API, supporting text and images. Automatically extracts the first paragraph as summary. Supports draft creation, listing, publishing, and deletion.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# 微信公众号草稿箱管理

通过微信公众号 API 管理草稿箱内容,支持创建图文消息、上传图片、发布文章。

## 功能特性

- 📝 **图文草稿** - 创建带格式的图文消息
- 🖼️ **图片支持** - 自动上传正文和封面图片
- 🎨 **自动封面** - 未提供封面时自动生成默认封面图(蓝紫色渐变)
- 📋 **自动摘要** - 正文第一段自动提取为文章摘要
- 📊 **草稿管理** - 查看、发布、删除草稿
- 🔗 **发布接口** - 支持通过 API 发布(需权限)

## 前提条件

### 1. 微信公众号认证

- 拥有一个微信公众号(订阅号或服务号)
- 完成微信认证(部分接口需要)

### 2. 获取开发者凭证

1. 登录 [微信公众平台](https://mp.weixin.qq.com)
2. 开发 → 基本配置 → 开发者ID
3. 获取 **AppID** 和 **AppSecret**
4. 添加服务器 IP 到白名单

### 3. 配置环境变量

```bash
# 添加到 ~/.zshrc
export WECHAT_APPID="your-app-id"
export WECHAT_APPSECRET="your-app-secret"
```

然后执行:
```bash
source ~/.zshrc
```

## 使用方法

### 创建草稿

**基础用法(自动生成封面图):**
```bash
python3 scripts/channel.py create "文章标题" "这里是正文内容..."
```

**从文件读取正文(自动生成封面图):**
```bash
python3 scripts/channel.py create "文章标题" --file article.txt
```

**带自定义封面图:**
```bash
python3 scripts/channel.py create "文章标题" "正文内容..." --cover cover.jpg
```

**禁止自动生成封面图:**
```bash
python3 scripts/channel.py create "文章标题" "正文..." --no-auto-cover
```

**设置作者:**
```bash
python3 scripts/channel.py create "文章标题" "正文..." --author "张三"
```

### 正文格式

**纯文本:**
```bash
python3 scripts/channel.py create "标题" "这是正文内容,支持换行。\n\n第二段内容..."
```

**带图片(Markdown 格式):**
```bash
python3 scripts/channel.py create "标题" "正文\n\n!<span class=\"image\"><span>描述</span></span>(/path/to/image.jpg)\n\n更多内容..."
```

**HTML 格式:**
```bash
python3 scripts/channel.py create "标题" "<p>正文</p><img src='url' />"
```

### 查看草稿列表

```bash
# 列出最近 20 篇
python3 scripts/channel.py list

# 列出最近 50 篇
python3 scripts/channel.py list --limit 50
```

输出示例:
```
📝 草稿列表 (3 篇):

序号   Media ID                       标题                                     更新时间
----------------------------------------------------------------------------------------------------
1      MEDIA_ID_1234567890abcdef    欢迎使用微信公众号                         2024-02-03 15:30
2      MEDIA_ID_abcdef1234567890    文章标题示例                               2024-02-03 14:20
3      MEDIA_ID_xxxxxxxxxxxxxxxx    测试草稿                                   2024-02-03 13:10
```

### 发布草稿

```bash
python3 scripts/channel.py publish MEDIA_ID_1234567890abcdef
```

⚠️ **注意**:发布接口需要开通发布权限,部分账号可能需要手动在后台发布。

### 删除草稿

```bash
python3 scripts/channel.py delete MEDIA_ID_1234567890abcdef
```

## 命令参考

| 命令 | 功能 | 示例 |
|------|------|------|
| `create` | 创建草稿 | `create "标题" "正文" --cover img.jpg` |
| `list` | 列岀草稿 | `list --limit 20` |
| `publish` | 发布草稿 | `publish media_id` |
| `delete` | 删除草稿 | `delete media_id` |

### create 命令参数

| 参数 | 简写 | 说明 | 必填 |
|------|------|------|------|
| `title` | - | 文章标题 | 是 |
| `content` | - | 正文内容 | 否(可用 --file) |
| `--file` | `-f` | 从文件读取正文 | 否 |
| `--author` | `-a` | 作者名称 | 否 |
| `--cover` | `-c` | 封面图片路径 | 否 |
| `--no-auto-cover` | - | 禁止自动生成封面图 | 否 |
| `--no-comment` | - | 关闭评论 | 否 |
| `--fans-only` | - | 仅粉丝可评论 | 否 |

## 自动封面图

当未提供 `--cover` 参数时,工具会自动生成一张默认封面图:

- **尺寸**: 900×500 像素(微信公众号推荐尺寸)
- **样式**: 蓝紫色渐变背景
- **格式**: JPEG
- **提示**: 自动生成时会显示 "🎨 未提供封面图,正在自动生成..."

如需使用自定义封面,请使用 `--cover` 参数指定图片路径。

## 正文内容格式

### Markdown 支持

- `**粗体**` → 粗体
- `*斜体*` → 斜体
- `<span class="image"><span>描述</span></span>(路径)` → 图片(自动上传)

### 图片处理

**本地图片(自动上传):**
```markdown
!<span class="image"><span>图片描述</span></span>(/path/to/local/image.jpg)
```

**网络图片(直接使用):**
```markdown
!<span class="image"><span>图片描述</span></span>(https://example.com/image.jpg)
```

### 摘要提取规则

- 自动提取正文第一段作为摘要
- 移除 HTML 标签
- 超过 120 字符自动截断并添加 "..."
- 用于文章列表展示和分享预览

## 输出结果

创建成功示例:
```
============================================================
✅ 草稿创建成功!
============================================================
📄 Media ID: MEDIA_ID_1234567890abcdef
📝 标题: 欢迎使用微信公众号
📋 摘要: 这是文章的摘要内容,来自正文第一段...
⏰ 创建时间: 2024-02-03T15:30:45.123456

💡 提示:
   - 草稿已保存到微信公众号后台
   - 请登录 mp.weixin.qq.com 查看并发布
   - 或使用 'publish' 命令直接发布(需开通权限)
============================================================
```

## 使用场景

### 场景1:快速发布文章

```bash
# 创建并准备发布
python3 scripts/channel.py create "今日新闻" "今天的重要新闻是..." --author "编辑部"

# 然后手动或自动发布
python3 scripts/channel.py list
python3 scripts/channel.py publish MEDIA_ID_xxxx
```

### 场景2:批量导入文章

```bash
# 准备多个文章文件
for file in articles/*.md; do
    title=$(head -1 "$file")
    python3 scripts/channel.py create "$title" --file "$file"
done
```

### 场景3:自动化发布流程

```bash
#!/bin/bash
# publish_daily.sh

TITLE="$(date +%Y年%m月%d日) 日报"
CONTENT=$(cat template.txt)

# 创建草稿
RESULT=$(python3 scripts/channel.py create "$TITLE" "$CONTENT" --cover daily_cover.jpg)

# 提取 Media ID 并发布(可选)
# MEDIA_ID=$(echo "$RESULT" | grep "Media ID:" | awk '{print $3}')
# python3 scripts/channel.py publish "$MEDIA_ID"
```

## 常见问题

**错误:请设置环境变量 WECHAT_APPID 和 WECHAT_APPSECRET**
→ 检查环境变量是否正确设置并生效

**错误:access_token missing**
→ 检查 AppID 和 AppSecret 是否正确
→ 确认服务器 IP 已添加到公众号白名单

**错误:api unauthorized**
→ 公众号未认证,部分接口需要微信认证
→ 订阅号和服务号权限不同

**图片上传失败**
→ 检查图片路径是否正确
→ 图片大小不能超过 10MB
→ 支持格式:jpg, png, gif

**发布失败**
→ 确认已开通发布权限
→ 部分账号需要手动在后台发布

## API 限制

| 接口 | 每日限制 | 说明 |
|------|----------|------|
| 获取 Access Token | 2000 次 | 有效期 7200 秒 |
| 创建草稿 | 100 篇 | 草稿总数上限 100 |
| 上传图片 | 无明确限制 | 单张最大 10MB |
| 发布 | 无明确限制 | 需要发布权限 |

## 注意事项

1. **草稿数量** - 草稿箱最多保存 100 篇,超出需要删除旧草稿
2. **图片存储** - 上传的图片存储在微信服务器,有有效期限制
3. **内容审核** - 发布的内容需要符合微信内容规范
4. **原创声明** - 可通过 API 声明原创(需额外参数)

## 参考

- 微信公众号文档: https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Overview.html
- 草稿箱接口: [references/wechat_api.md](references/wechat_api.md)
- 微信公众平台: https://mp.weixin.qq.com

Related Skills

Partnership & Channel Revenue Engine

3891
from openclaw/skills

Turn partnerships from handshake deals into a systematic revenue machine. This is the complete playbook for finding, qualifying, structuring, launching, and scaling partner-driven growth — whether you're building integration partnerships, reseller channels, affiliate programs, or strategic alliances.

Workflow & Productivity

Channel Partner Program Framework

3891
from openclaw/skills

Build, manage, and scale a channel partner program that generates indirect revenue without adding headcount.

Business Strategy & Growth

Ad Ops & Cross-Channel Advertising Agent

3880
from openclaw/skills

Autonomous advertising operations framework for AI agents managing campaigns across Google Ads, Meta, LinkedIn, TikTok, and programmatic.

Marketing & Ad Operations

YouTube Channel Scraper

3891
from openclaw/skills

A browser-based YouTube channel discovery and scraping tool.

Channel Reminders

3891
from openclaw/skills

Навык для создания напоминаний через cron jobs с доставкой в Telegram.

WhatsApp Business Suite — AI Leads, Channels, Campaigns & 32 MCP Tools

3891
from openclaw/skills

Automate WhatsApp at scale — mine leads from groups with AI, broadcast to channel followers, bulk message with ban-safe delays, schedule campaigns, auto-reply in your voice, collect reviews, and track delivery. 90+ REST endpoints, 32 MCP tools for Claude & GPT, Python SDK. No Meta Business API required. Free tier available.

wechat-channel-live-replay

3891
from openclaw/skills

(已验证) 根据视频号名称搜索用户并下载指定日期的直播回放视频,支持自动转写直播稿。

Persona Channel Builder

3891
from openclaw/skills

Design and launch an autonomous AI-managed Telegram channel. Interview-driven persona creation → SOUL.md + CHANNEL.md + cron config + 3 sample posts. Ready to deploy on OpenClaw.

gotchi-channeling

3891
from openclaw/skills

Channel Aavegotchis on Base via Bankr. Checks cooldown, builds calldata, and submits channel txs safely.

---

3891
from openclaw/skills

name: article-factory-wechat

Content & Documentation

humanizer

3891
from openclaw/skills

Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.

Content & Documentation

find-skills

3891
from openclaw/skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

General Utilities