WeChat Content Publisher

Post to WeChat Official Account

by JimLiu · MIT license · ★ 26,555 on GitHub · v1.118.2

Post to WeChat Official Account cover

Posts content to WeChat Official Account (微信公众号) via API or Chrome CDP. Supports article posting (文章) with HTML, markdown, or plain text input, and image-text posting (贴图, formerly 图文) with multiple images.

---
name: baoyu-post-to-wechat
description: Posts content to WeChat Official Account (微信公众号) via API or Chrome CDP. Supports article posting (文章) with HTML, markdown, or plain text input, and image-text posting (贴图, formerly 图文) with multiple images. Markdown article workflows default to converting ordinary external links into bottom citations for WeChat-friendly output. Use when user mentions "发布公众号", "post to wechat", "微信公众号", or "贴图/图文/文章".
version: 1.118.2
metadata:
  openclaw:
    homepage: https://github.com/JimLiu/baoyu-skills#baoyu-post-to-wechat
    requires:
      anyBins:
        - bun
        - npx
---

# Post to WeChat Official Account

## User Input Tools

When this skill prompts the user, follow this tool-selection rule (priority order):

Overview

When this skill prompts the user, follow this tool-selection rule (priority order):

Manual install (npx, ZIP)
Claude Codenpx skills add JimLiu/baoyu-skills --skill baoyu-post-to-wechat -g -a claude-code
Claude Code (degit)npx degit JimLiu/baoyu-skills/skills/baoyu-post-to-wechat#main ~/.claude/skills/baoyu-post-to-wechat
Claude.ai / desktopZip the folder and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md14.5 KB
Read SKILL.md here
JimLiu/main1 file shown
SKILL.md
Show the full text299 lines

Post to WeChat Official Account

User Input Tools

When this skill prompts the user, follow this tool-selection rule (priority order):

  1. Prefer built-in user-input tools exposed by the current agent runtime — e.g., AskUserQuestion, request_user_input, clarify, ask_user, or any equivalent.
  2. Fallback: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.
  3. Batching: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.

Concrete AskUserQuestion references below are examples — substitute the local equivalent in other runtimes.

Language

Respond in the user's language. If they write in Chinese, reply in Chinese; if English, English. Keep technical tokens (paths, flags, field names) in English.

Script Directory

{baseDir} = this SKILL.md's directory. Resolve ${BUN_X}: prefer bun; else npx -y bun; else suggest brew install oven-sh/bun/bun.

Script Purpose
scripts/wechat-browser.ts Image-text posts (图文)
scripts/wechat-article.ts Article posting via browser (文章)
scripts/wechat-api.ts Article posting via API (文章)
scripts/md-to-wechat.ts Markdown → WeChat-ready HTML with image placeholders
scripts/check-permissions.ts Verify environment & permissions

Preferences (EXTEND.md)

Check these paths in order; first hit wins:

Path Scope
.baoyu-skills/baoyu-post-to-wechat/EXTEND.md Project
${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-wechat/EXTEND.md XDG
$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md User home

Found → read, parse, apply. Not found → run first-time setup (references/config/first-time-setup.md) before anything else.

Minimum keys (case-insensitive, accept 1/0 or true/false):

Key Default Mapping
default_author empty Fallback for author when CLI/frontmatter not provided
need_open_comment 1 articles[].need_open_comment in draft/add
only_fans_can_comment 0 articles[].only_fans_can_comment in draft/add

Recommended EXTEND.md:

default_theme: default
default_color: blue
default_publish_method: browser
default_author: 宝玉
need_open_comment: 1
only_fans_can_comment: 0
chrome_profile_path: /path/to/chrome/profile

# Remote API publishing (optional) — only set if WeChat's IP allowlist
# excludes your local machine. See "Remote API Method" below.
# remote_publish_host: server.example.com
# remote_publish_user: deploy
# remote_publish_port: 22
# remote_publish_identity_file: ~/.ssh/id_ed25519
# remote_publish_known_hosts_file: ~/.ssh/known_hosts
# remote_publish_strict_host_key_checking: accept-new
# remote_publish_connect_timeout: 10
# remote_publish_proxy_jump: bastion.example.com

Raw ssh / scp options are intentionally not supported; only the typed keys above are honored. Authentication is SSH key only (no passwords).

Theme options: default, grace, simple, modern. Color presets: blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange (or hex).

Value priority: CLI args → frontmatter → EXTEND.md (account-level → global) → skill defaults.

Multi-Account Support

EXTEND.md supports an accounts: block for managing multiple Official Accounts. With 2+ entries, the workflow inserts a Step 0.5 to prompt for account selection (or auto-selects based on default: true or --account <alias>).

Full details — compatibility rules, per-account keys, credential resolution, per-account Chrome profiles, CLI usage — in references/multi-account.md.

Pre-flight Check (Optional)

Before first use, suggest the environment check (user can skip):

${BUN_X} {baseDir}/scripts/check-permissions.ts

Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, API credentials, Chrome conflicts.

Check fails Fix
Chrome Install Chrome or set WECHAT_BROWSER_CHROME_PATH
Profile dir Shared profile at baoyu-skills/chrome-profile
Bun runtime brew install oven-sh/bun/bun or npm install -g bun
Accessibility (macOS) System Settings → Privacy & Security → Accessibility → enable terminal app
Clipboard copy Ensure Swift/AppKit (macOS: xcode-select --install)
Paste keystroke (Linux) Install xdotool (X11) or ydotool (Wayland)
API credentials Follow guided setup in Step 2, or set in .baoyu-skills/.env

Image-Text Posting (图文)

Short posts with multiple images (up to 9):

${BUN_X} {baseDir}/scripts/wechat-browser.ts --markdown article.md --images ./images/
${BUN_X} {baseDir}/scripts/wechat-browser.ts --title "标题" --content "内容" --image img.png --submit

Details: references/image-text-posting.md.

Article Posting Workflow (文章)

- [ ] Step 0: Load preferences (EXTEND.md)
- [ ] Step 0.5: Resolve account (multi-account only — see references/multi-account.md)
- [ ] Step 1: Determine input type
- [ ] Step 2: Select method and configure credentials
- [ ] Step 3: Resolve theme/color and validate metadata
- [ ] Step 4: Publish to WeChat
- [ ] Step 5: Report completion
Step 0: Load Preferences

Check and load EXTEND.md (see "Preferences" above). If not found, complete first-time setup before any other questions. Resolve and cache for later steps: default_theme, default_color, default_author, need_open_comment, only_fans_can_comment.

Step 1: Determine Input Type
Input Detection Next
HTML file Path ends .html, file exists Skip to Step 3
Markdown file Path ends .md, file exists Step 2
Plain text Not a file path, or file doesn't exist Save to markdown, then Step 2

Plain-text handling:

  1. Generate slug (first 2-4 meaningful words, kebab-case; translate Chinese to English for the slug).
  2. Save to post-to-wechat/YYYY-MM-DD/<slug>.md (create directory if needed).
  3. Continue as a markdown file.
Step 2: Select Publishing Method and Configure

Ask method unless specified in EXTEND.md or CLI:

Method Speed Requires
api (Recommended) Fast API credentials (local IP allowlisted)
browser Slow Chrome + logged-in session
remote-api Fast API credentials + an SSH-reachable server whose IP is on the WeChat allowlist

API selected + missing credentials → run guided setup per references/api-setup.md (writes to .baoyu-skills/.env).

remote-api method: WeChat's "公众号设置 → IP 白名单" often limits API access to one or two fixed IPs. If your local machine's IP is not on that list but a cloud server's is, use remote-api: all markdown rendering, image processing, draft assembly, and HTML rewriting still happen locally, and only the outbound HTTPS calls to api.weixin.qq.com (token, uploadimg, add_material, draft/add) are tunneled through an SSH SOCKS5 dynamic port forward (ssh -N -D) so that WeChat sees the remote server as the source IP. No files are written to the remote host; AppSecret never leaves the local process. Requires only sshd and outbound network on the remote host — no Python, no agent process. See "Remote API Method" below.

Step 3: Resolve Theme/Color and Validate Metadata
  1. Theme: CLI --theme → EXTEND.md default_theme → default (first match wins; do NOT ask if resolved).
  2. Color: CLI --color → EXTEND.md default_color → omit (theme default applies).
  3. Validate metadata (frontmatter for markdown, meta tags for HTML):
Field Missing →
Title Ask, or press Enter to auto-generate from content
Summary Frontmatter description → summary → ask or auto-generate
Author CLI --author → frontmatter author → EXTEND.md default_author
Source URL CLI --source-url → frontmatter sourceUrl/contentSourceUrl/content_source_url

Auto-generation: title = first H1/H2 or first sentence; summary = first paragraph, truncated to 120 chars.

  1. Cover image (required for API article_type=news): CLI --cover → frontmatter (coverImage / featureImage / cover / image) → imgs/cover.png → first inline image → stop and request one if still missing.
Step 4: Publish

Important — never pre-convert markdown to HTML. Publishing scripts handle the conversion internally and the two methods render images differently: API renders <img> tags for upload, browser uses placeholders for paste-and-replace. Passing a pre-converted HTML breaks one or the other.

Markdown citation default: for markdown input, ordinary external links are converted to bottom citations by default. Use --no-cite only if the user explicitly wants to keep inline links. Existing HTML input is left as-is.

API method (accepts .md or .html):

${BUN_X} {baseDir}/scripts/wechat-api.ts <file> --theme <theme> [--color <color>] [--title <title>] [--summary <summary>] [--author <author>] [--cover <cover_path>] [--source-url <url>] [--no-cite]

Always pass --theme even if it's default. Only pass --color when explicitly set by the user or EXTEND.md.

Remote API method (same script, adds --remote):

${BUN_X} {baseDir}/scripts/wechat-api.ts <file> --theme <theme> --remote [--remote-host <host>] [--remote-user <user>] [--remote-port <port>] [--remote-identity-file <path>] [--remote-known-hosts-file <path>] [--remote-strict-host-key-checking yes|no|accept-new] [--remote-connect-timeout <s>] [--remote-proxy-jump <spec>]

Any --remote-* flag implies --remote. CLI values override account-level then global remote_publish_* keys from EXTEND.md. Setting default_publish_method: remote-api also enables remote mode without --remote.

draft/add payload rules:

  • Endpoint: POST https://api.weixin.qq.com/cgi-bin/draft/add?access_token=ACCESS_TOKEN
  • article_type: news (default) or newspic
  • For news, include thumb_media_id (cover required)
  • Always include need_open_comment (default 1) and only_fans_can_comment (default 0) in the request body, even if the CLI doesn't expose them
  • For news, optionally include content_source_url (original article URL, shown as "阅读原文" link, max 1KB). Provide via --source-url CLI flag or frontmatter sourceUrl/contentSourceUrl/content_source_url

Browser method (accepts --markdown or --html):

${BUN_X} {baseDir}/scripts/wechat-article.ts --markdown <markdown_file> --theme <theme> [--color <color>] [--no-cite]
${BUN_X} {baseDir}/scripts/wechat-article.ts --html <html_file>
Step 5: Completion Report
WeChat Publishing Complete!

Input: [type] - [path]
Method: [API | Browser]
Theme: [theme] [color if set]

Article:
• Title: [title]
• Summary: [summary]
• Images: [N] inline
• Comments: [open/closed], [fans-only/all]    ← API method only

Result:
✓ Draft saved to WeChat Official Account
• media_id: [media_id]                         ← API method only

Next Steps (API):
→ Manage drafts: https://mp.weixin.qq.com (登录后进入「内容管理」→「草稿箱」)

Files created:
[• post-to-wechat/YYYY-MM-DD/slug.md (if plain text input)]
[• slug.html (converted)]

Feature Comparison

Feature Image-Text Article (API) Article (Remote API) Article (Browser)
Plain text input ✗ ✓ ✓ ✓
HTML input ✗ ✓ ✓ ✓
Markdown input Title/content ✓ ✓ ✓
Multiple images ✓ (up to 9) ✓ (inline) ✓ (inline) ✓ (inline)
Themes ✗ ✓ ✓ ✓
Auto-generate metadata ✗ ✓ ✓ ✓
Default cover fallback (imgs/cover.png) ✗ ✓ ✓ ✗
Comment control ✗ ✓ ✓ ✗
Requires Chrome ✓ ✗ ✗ ✓
Requires API credentials ✗ ✓ ✓ ✗
Requires SSH-reachable server with allowlisted IP ✗ ✗ ✓ ✗
Speed Medium Fast Fast Slow

Troubleshooting

Issue Fix
Missing API credentials Follow guided setup in Step 2
Access token error Verify credentials valid and not expired
Not logged in (browser) First run opens browser — scan QR to log in. Set TELEGRAM_BOT_TOKEN + TELEGRAM_CHAT_ID to receive the QR image via Telegram
Chrome not found Set WECHAT_BROWSER_CHROME_PATH
Title/summary missing Use auto-generation or provide manually
No cover image Add frontmatter cover or place imgs/cover.png in article directory
Wrong comment defaults Check need_open_comment / only_fans_can_comment in EXTEND.md
Paste fails Check system clipboard permissions
Remote publish host is required Set --remote-host or remote_publish_host in EXTEND.md
SOCKS proxy on 127.0.0.1:… not ready SSH could not start the tunnel — check key, host, StrictHostKeyChecking, or use --remote-connect-timeout
ssh exited early during remote publish Verify the user can ssh non-interactively to the server; raise --remote-connect-timeout if the link is slow
Remote API call returns errcode 40164 (invalid IP) The remote server's egress IP is not on WeChat's allowlist; add it in 公众号设置 → IP 白名单

References

File Content
references/image-text-posting.md Image-text parameters, auto-compression
references/article-posting.md Article themes, image handling
references/multi-account.md Multi-account compatibility, credentials, Chrome profiles, CLI
references/api-setup.md Guided credential setup
references/config/first-time-setup.md First-time EXTEND.md setup

Extension Support

Custom configurations via EXTEND.md. See "Preferences" for paths and supported options.

1---
2name: baoyu-post-to-wechat
3description: Posts content to WeChat Official Account (微信公众号) via API or Chrome CDP. Supports article posting (文章) with HTML, markdown, or plain text input, and image-text posting (贴图, formerly 图文) with multiple images. Markdown article workflows default to converting ordinary external links into bottom citations for WeChat-friendly output. Use when user mentions "发布公众号", "post to wechat", "微信公众号", or "贴图/图文/文章".
4version: 1.118.2
5metadata:
6 openclaw:
7 homepage: https://github.com/JimLiu/baoyu-skills#baoyu-post-to-wechat
8 requires:
9 anyBins:
10 - bun
11 - npx
12---
13 
14# Post to WeChat Official Account
15 
16## User Input Tools
17 
18When this skill prompts the user, follow this tool-selection rule (priority order):
19 
201. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent.
212. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.
223. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.
23 
24Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes.
25 
26## Language
27 
28Respond in the user's language. If they write in Chinese, reply in Chinese; if English, English. Keep technical tokens (paths, flags, field names) in English.
29 
30## Script Directory
31 
32`{baseDir}` = this SKILL.md's directory. Resolve `${BUN_X}`: prefer `bun`; else `npx -y bun`; else suggest `brew install oven-sh/bun/bun`.
33 
34| Script | Purpose |
35|--------|---------|
36| `scripts/wechat-browser.ts` | Image-text posts (图文) |
37| `scripts/wechat-article.ts` | Article posting via browser (文章) |
38| `scripts/wechat-api.ts` | Article posting via API (文章) |
39| `scripts/md-to-wechat.ts` | Markdown → WeChat-ready HTML with image placeholders |
40| `scripts/check-permissions.ts` | Verify environment & permissions |
41 
42## Preferences (EXTEND.md)
43 
44Check these paths in order; first hit wins:
45 
46| Path | Scope |
47|------|-------|
48| `.baoyu-skills/baoyu-post-to-wechat/EXTEND.md` | Project |
49| `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-wechat/EXTEND.md` | XDG |
50| `$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md` | User home |
51 
52Found → read, parse, apply. Not found → run first-time setup (`references/config/first-time-setup.md`) before anything else.
53 
54**Minimum keys** (case-insensitive, accept `1/0` or `true/false`):
55 
56| Key | Default | Mapping |
57|-----|---------|---------|
58| `default_author` | empty | Fallback for `author` when CLI/frontmatter not provided |
59| `need_open_comment` | `1` | `articles[].need_open_comment` in `draft/add` |
60| `only_fans_can_comment` | `0` | `articles[].only_fans_can_comment` in `draft/add` |
61 
62**Recommended EXTEND.md**:
63 
64```md
65default_theme: default
66default_color: blue
67default_publish_method: browser
68default_author: 宝玉
69need_open_comment: 1
70only_fans_can_comment: 0
71chrome_profile_path: /path/to/chrome/profile
72 
73# Remote API publishing (optional) — only set if WeChat's IP allowlist
74# excludes your local machine. See "Remote API Method" below.
75# remote_publish_host: server.example.com
76# remote_publish_user: deploy
77# remote_publish_port: 22
78# remote_publish_identity_file: ~/.ssh/id_ed25519
79# remote_publish_known_hosts_file: ~/.ssh/known_hosts
80# remote_publish_strict_host_key_checking: accept-new
81# remote_publish_connect_timeout: 10
82# remote_publish_proxy_jump: bastion.example.com
83```
84 
85Raw `ssh` / `scp` options are intentionally not supported; only the typed keys above are honored. Authentication is SSH key only (no passwords).
86 
87**Theme options**: default, grace, simple, modern. **Color presets**: blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange (or hex).
88 
89**Value priority**: CLI args → frontmatter → EXTEND.md (account-level → global) → skill defaults.
90 
91## Multi-Account Support
92 
93EXTEND.md supports an `accounts:` block for managing multiple Official Accounts. With 2+ entries, the workflow inserts a Step 0.5 to prompt for account selection (or auto-selects based on `default: true` or `--account <alias>`).
94 
95Full details — compatibility rules, per-account keys, credential resolution, per-account Chrome profiles, CLI usage — in `references/multi-account.md`.
96 
97## Pre-flight Check (Optional)
98 
99Before first use, suggest the environment check (user can skip):
100 
101```bash
102${BUN_X} {baseDir}/scripts/check-permissions.ts
103```
104 
105Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, API credentials, Chrome conflicts.
106 
107| Check fails | Fix |
108|-------------|-----|
109| Chrome | Install Chrome or set `WECHAT_BROWSER_CHROME_PATH` |
110| Profile dir | Shared profile at `baoyu-skills/chrome-profile` |
111| Bun runtime | `brew install oven-sh/bun/bun` or `npm install -g bun` |
112| Accessibility (macOS) | System Settings → Privacy & Security → Accessibility → enable terminal app |
113| Clipboard copy | Ensure Swift/AppKit (macOS: `xcode-select --install`) |
114| Paste keystroke (Linux) | Install `xdotool` (X11) or `ydotool` (Wayland) |
115| API credentials | Follow guided setup in Step 2, or set in `.baoyu-skills/.env` |
116 
117## Image-Text Posting (图文)
118 
119Short posts with multiple images (up to 9):
120 
121```bash
122${BUN_X} {baseDir}/scripts/wechat-browser.ts --markdown article.md --images ./images/
123${BUN_X} {baseDir}/scripts/wechat-browser.ts --title "标题" --content "内容" --image img.png --submit
124```
125 
126Details: `references/image-text-posting.md`.
127 
128## Article Posting Workflow (文章)
129 
130```
131- [ ] Step 0: Load preferences (EXTEND.md)
132- [ ] Step 0.5: Resolve account (multi-account only — see references/multi-account.md)
133- [ ] Step 1: Determine input type
134- [ ] Step 2: Select method and configure credentials
135- [ ] Step 3: Resolve theme/color and validate metadata
136- [ ] Step 4: Publish to WeChat
137- [ ] Step 5: Report completion
138```
139 
140### Step 0: Load Preferences
141 
142Check and load EXTEND.md (see "Preferences" above). If not found, complete first-time setup before any other questions. Resolve and cache for later steps: `default_theme`, `default_color`, `default_author`, `need_open_comment`, `only_fans_can_comment`.
143 
144### Step 1: Determine Input Type
145 
146| Input | Detection | Next |
147|-------|-----------|------|
148| HTML file | Path ends `.html`, file exists | Skip to Step 3 |
149| Markdown file | Path ends `.md`, file exists | Step 2 |
150| Plain text | Not a file path, or file doesn't exist | Save to markdown, then Step 2 |
151 
152**Plain-text handling**:
153 
1541. Generate slug (first 2-4 meaningful words, kebab-case; translate Chinese to English for the slug).
1552. Save to `post-to-wechat/YYYY-MM-DD/<slug>.md` (create directory if needed).
1563. Continue as a markdown file.
157 
158### Step 2: Select Publishing Method and Configure
159 
160Ask method unless specified in EXTEND.md or CLI:
161 
162| Method | Speed | Requires |
163|--------|-------|----------|
164| `api` (Recommended) | Fast | API credentials (local IP allowlisted) |
165| `browser` | Slow | Chrome + logged-in session |
166| `remote-api` | Fast | API credentials + an SSH-reachable server whose IP is on the WeChat allowlist |
167 
168**API selected + missing credentials** → run guided setup per `references/api-setup.md` (writes to `.baoyu-skills/.env`).
169 
170**`remote-api` method**: WeChat's "公众号设置 → IP 白名单" often limits API access to one or two fixed IPs. If your local machine's IP is not on that list but a cloud server's is, use `remote-api`: all markdown rendering, image processing, draft assembly, and HTML rewriting still happen locally, and only the outbound HTTPS calls to `api.weixin.qq.com` (token, uploadimg, add_material, draft/add) are tunneled through an SSH SOCKS5 dynamic port forward (`ssh -N -D`) so that WeChat sees the remote server as the source IP. No files are written to the remote host; `AppSecret` never leaves the local process. Requires only `sshd` and outbound network on the remote host — no Python, no agent process. See "Remote API Method" below.
171 
172### Step 3: Resolve Theme/Color and Validate Metadata
173 
1741. **Theme**: CLI `--theme` → EXTEND.md `default_theme` → `default` (first match wins; do NOT ask if resolved).
1752. **Color**: CLI `--color` → EXTEND.md `default_color` → omit (theme default applies).
1763. **Validate metadata** (frontmatter for markdown, meta tags for HTML):
177 
178| Field | Missing → |
179|-------|-----------|
180| Title | Ask, or press Enter to auto-generate from content |
181| Summary | Frontmatter `description` → `summary` → ask or auto-generate |
182| Author | CLI `--author` → frontmatter `author` → EXTEND.md `default_author` |
183| Source URL | CLI `--source-url` → frontmatter `sourceUrl`/`contentSourceUrl`/`content_source_url` |
184 
185Auto-generation: title = first H1/H2 or first sentence; summary = first paragraph, truncated to 120 chars.
186 
1874. **Cover image** (required for API `article_type=news`): CLI `--cover` → frontmatter (`coverImage` / `featureImage` / `cover` / `image`) → `imgs/cover.png` → first inline image → stop and request one if still missing.
188 
189### Step 4: Publish
190 
191**Important — never pre-convert markdown to HTML.** Publishing scripts handle the conversion internally and the two methods render images differently: API renders `<img>` tags for upload, browser uses placeholders for paste-and-replace. Passing a pre-converted HTML breaks one or the other.
192 
193**Markdown citation default**: for markdown input, ordinary external links are converted to bottom citations by default. Use `--no-cite` only if the user explicitly wants to keep inline links. Existing HTML input is left as-is.
194 
195**API method** (accepts `.md` or `.html`):
196 
197```bash
198${BUN_X} {baseDir}/scripts/wechat-api.ts <file> --theme <theme> [--color <color>] [--title <title>] [--summary <summary>] [--author <author>] [--cover <cover_path>] [--source-url <url>] [--no-cite]
199```
200 
201Always pass `--theme` even if it's `default`. Only pass `--color` when explicitly set by the user or EXTEND.md.
202 
203**Remote API method** (same script, adds `--remote`):
204 
205```bash
206${BUN_X} {baseDir}/scripts/wechat-api.ts <file> --theme <theme> --remote [--remote-host <host>] [--remote-user <user>] [--remote-port <port>] [--remote-identity-file <path>] [--remote-known-hosts-file <path>] [--remote-strict-host-key-checking yes|no|accept-new] [--remote-connect-timeout <s>] [--remote-proxy-jump <spec>]
207```
208 
209Any `--remote-*` flag implies `--remote`. CLI values override account-level then global `remote_publish_*` keys from EXTEND.md. Setting `default_publish_method: remote-api` also enables remote mode without `--remote`.
210 
211**`draft/add` payload rules**:
212- Endpoint: `POST https://api.weixin.qq.com/cgi-bin/draft/add?access_token=ACCESS_TOKEN`
213- `article_type`: `news` (default) or `newspic`
214- For `news`, include `thumb_media_id` (cover required)
215- Always include `need_open_comment` (default `1`) and `only_fans_can_comment` (default `0`) in the request body, even if the CLI doesn't expose them
216- For `news`, optionally include `content_source_url` (original article URL, shown as "阅读原文" link, max 1KB). Provide via `--source-url` CLI flag or frontmatter `sourceUrl`/`contentSourceUrl`/`content_source_url`
217 
218**Browser method** (accepts `--markdown` or `--html`):
219 
220```bash
221${BUN_X} {baseDir}/scripts/wechat-article.ts --markdown <markdown_file> --theme <theme> [--color <color>] [--no-cite]
222${BUN_X} {baseDir}/scripts/wechat-article.ts --html <html_file>
223```
224 
225### Step 5: Completion Report
226 
227```
228WeChat Publishing Complete!
229 
230Input: [type] - [path]
231Method: [API | Browser]
232Theme: [theme] [color if set]
233 
234Article:
235• Title: [title]
236• Summary: [summary]
237• Images: [N] inline
238• Comments: [open/closed], [fans-only/all] ← API method only
239 
240Result:
241✓ Draft saved to WeChat Official Account
242• media_id: [media_id] ← API method only
243 
244Next Steps (API):
245→ Manage drafts: https://mp.weixin.qq.com (登录后进入「内容管理」→「草稿箱」)
246 
247Files created:
248[• post-to-wechat/YYYY-MM-DD/slug.md (if plain text input)]
249[• slug.html (converted)]
250```
251 
252## Feature Comparison
253 
254| Feature | Image-Text | Article (API) | Article (Remote API) | Article (Browser) |
255|---------|:---:|:---:|:---:|:---:|
256| Plain text input | ✗ | ✓ | ✓ | ✓ |
257| HTML input | ✗ | ✓ | ✓ | ✓ |
258| Markdown input | Title/content | ✓ | ✓ | ✓ |
259| Multiple images | ✓ (up to 9) | ✓ (inline) | ✓ (inline) | ✓ (inline) |
260| Themes | ✗ | ✓ | ✓ | ✓ |
261| Auto-generate metadata | ✗ | ✓ | ✓ | ✓ |
262| Default cover fallback (`imgs/cover.png`) | ✗ | ✓ | ✓ | ✗ |
263| Comment control | ✗ | ✓ | ✓ | ✗ |
264| Requires Chrome | ✓ | ✗ | ✗ | ✓ |
265| Requires API credentials | ✗ | ✓ | ✓ | ✗ |
266| Requires SSH-reachable server with allowlisted IP | ✗ | ✗ | ✓ | ✗ |
267| Speed | Medium | Fast | Fast | Slow |
268 
269## Troubleshooting
270 
271| Issue | Fix |
272|-------|-----|
273| Missing API credentials | Follow guided setup in Step 2 |
274| Access token error | Verify credentials valid and not expired |
275| Not logged in (browser) | First run opens browser — scan QR to log in. Set `TELEGRAM_BOT_TOKEN` + `TELEGRAM_CHAT_ID` to receive the QR image via Telegram |
276| Chrome not found | Set `WECHAT_BROWSER_CHROME_PATH` |
277| Title/summary missing | Use auto-generation or provide manually |
278| No cover image | Add frontmatter cover or place `imgs/cover.png` in article directory |
279| Wrong comment defaults | Check `need_open_comment` / `only_fans_can_comment` in EXTEND.md |
280| Paste fails | Check system clipboard permissions |
281| `Remote publish host is required` | Set `--remote-host` or `remote_publish_host` in EXTEND.md |
282| `SOCKS proxy on 127.0.0.1:… not ready` | SSH could not start the tunnel — check key, host, `StrictHostKeyChecking`, or use `--remote-connect-timeout` |
283| `ssh exited early` during remote publish | Verify the user can `ssh` non-interactively to the server; raise `--remote-connect-timeout` if the link is slow |
284| Remote API call returns `errcode 40164` (invalid IP) | The remote server's egress IP is not on WeChat's allowlist; add it in 公众号设置 → IP 白名单 |
285 
286## References
287 
288| File | Content |
289|------|---------|
290| `references/image-text-posting.md` | Image-text parameters, auto-compression |
291| `references/article-posting.md` | Article themes, image handling |
292| `references/multi-account.md` | Multi-account compatibility, credentials, Chrome profiles, CLI |
293| `references/api-setup.md` | Guided credential setup |
294| `references/config/first-time-setup.md` | First-time EXTEND.md setup |
295 
296## Extension Support
297 
298Custom configurations via EXTEND.md. See "Preferences" for paths and supported options.
299 
View all files on GitHub →

Details

Version
1.118.2
License
MIT
Stars on the repo
★ 26,555
Checked
Source
JimLiu/baoyu-skills ↗
Creator
JimLiu · 13 listings
View creator

Similar skills

See all →
SkillLast 30 Days Researchmvanhorn/last30days-skill · by mvanhornResearch what people actually say about any topic in the last 30 days. Pulls posts and engagement from Reddit, X, YouTube, TikTok, Hacker News, Polymarket, GitHub, and the web. Includes a doctor health check to diagnose broken or missing sources.★ 63.5k GitHub starsSkillSocial Platform Scraperdanielmiessler/LifeOS · by danielmiesslerScrapes social platforms, business data, and e-commerce via Apify actors — Instagram, LinkedIn, TikTok, YouTube, Facebook, Google Maps, Amazon, and web crawls — filtering in code. USE WHEN scrape Instagram, scrape LinkedIn, scrape TikTok, scrape YouTube, scrape Facebook, Google Maps leads, Amazon reviews, business intelligence, multi-platform social listening, competitive analysis, lead generation, social monitoring, Apify actors, web crawl, extract contacts. NOT FOR X/Twitter account operations like posting, threads, or bookmarks (those need a dedicated X API client), 4-tier progressive scraping with proxy escalation (use BrightData), or real-Chrome bot bypass and computer use (use Interceptor).★ 19.3k GitHub starsSkillWeChat Article Publishertsingyuai/growth-lab · by tsingyuai微信公众号长文增长闭环 —— 从读者问题与复刻锚选题、写出可验证的公众号长文、预览与合规检查、同步微信草稿、三重确认下受控发布,到回收阅读与转化数据并复盘。用户要求写公众号、把内容改成公众号、同步或发布微信草稿、查看公众号数据或复盘时使用。★ 2k GitHub starsSkillTwitter Content SearchReScienceLab/opc-skills · by ReScienceLabSearch and retrieve content from Twitter/X. Get user info, tweets, replies, followers, communities, spaces, and trends via twitterapi.io. Use when user mentions Twitter, X, or tweets.★ 1.8k GitHub starsSkillYouTube Script Writercwinvestments/memstack · by cwinvestmentsUse this skill when the user says 'YouTube script', 'video script', 'write script for YouTube', 'YouTube video outline', or is creating scripted content for a YouTube video with hooks, chapters, and CTAs. Do NOT use for TikTok/Reels short-form scripts or webinar presentations.★ 423 GitHub starsSkillInternet Research RouterOotto-AI/claude-content-skills · by Ootto-AIMUST USE when user wants to 调研/research/搜索/search/查/找/look up anything on the internet — e.g. 全网调研 X / 帮我调研一下 X / 查一下 X / 搜搜 X / 看看大家怎么评价 X / X 上有什么讨论 / research this topic。 Also MUST USE when user mentions any platform or shares any URL/链接: 小红书/xiaohongshu/xhs, Twitter/推特/X, B站/bilibili, Reddit, V2EX, LinkedIn/领英/招聘/求职/jobs, YouTube, GitHub code search, 小宇宙播客, 雪球/股票行情, RSS feeds, or any web URL. 13 platforms, multi-backend routing (OpenCLI / per-platform CLIs / APIs). Zero config for 6 channels. Run `agent-reach doctor --json` to see which backend serves each platform right now. NOT for: 写报告/数据分析/翻译等内容加工(本 skill 只负责从互联网获取内容); 发帖/评论/点赞等写操作;已有专门 skill 的平台(先用专门 skill)。 【路由方式】SKILL.md 包含路由表和常用命令,复杂场景需按需阅读对应分类的 references/*.md。 分类:search / social (小红书/推特/B站/V2EX/Reddit) / career(LinkedIn) / dev(github) / web(网页/文章/RSS) / video(YouTube/B站/播客)。★ 139 GitHub stars

More from JimLiu

SkillArticle Illustration GeneratorJimLiu/baoyu-skills · by JimLiuAnalyzes article structure, identifies positions requiring visual aids, generates illustrations with Type × Style × Palette three-dimension approach. Use when user asks to "illustrate article", "add images", "generate images for article", or "为文章配图".★ 26.6k GitHub starsSkillArticle Cover DesignerJimLiu/baoyu-skills · by JimLiuGenerates article cover images with 5 dimensions (type, palette, rendering, text, mood) combining 11 color palettes and 7 rendering styles. Supports cinematic (2.35:1), widescreen (16:9), and square (1:1) aspects. Use when user asks to "generate cover image", "create article cover", or "make cover".★ 26.6k GitHub starsSkillSVG Diagram CreatorJimLiu/baoyu-skills · by JimLiuCreate professional, dark-themed SVG diagrams of any type — architecture diagrams, flowcharts, sequence diagrams, structural diagrams, mind maps, timelines, illustrative/conceptual diagrams, and more. Use this skill whenever the user asks for any kind of technical or conceptual diagram, visualization of a system, process flow, data flow, component relationship, network topology, decision tree, org chart, state machine, or any visual representation of structure/logic/process. Also trigger when the user says "画个图" "画一个架构图" "diagram" "flowchart" "sequence diagram" "draw me a ..." or uploads content and asks to visualize it. Output is always a standalone .svg file.★ 26.6k GitHub starsSkillSocial Card Series CreatorJimLiu/baoyu-skills · by JimLiuGenerates infographic image card series with 12 visual styles, 8 layouts, and 3 color palettes. Breaks content into 1-10 cartoon-style image cards optimized for social media engagement. Use when user mentions "小红书图片", "小红书种草", "小绿书", "微信图文", "微信贴图", "image cards", "图片卡片", baoyu-xhs-images, or wants social media infographic series.★ 26.6k GitHub starsSkillMulti-Model Image GeneratorJimLiu/baoyu-skills · by JimLiuAI image generation with OpenAI GPT Image 2.5, Azure OpenAI, Google, OpenRouter, DashScope, Z.AI GLM-Image, MiniMax, Jimeng, Seedream, Replicate and Agnes APIs. Supports text-to-image, reference images, aspect ratios, and batch generation from saved prompt files. Sequential by default; use batch parallel generation when the user already has multiple prompts or wants stable multi-image throughput. Use when user asks to generate, create, or draw images.★ 26.6k GitHub starsSkillData Visualization CreatorJimLiu/baoyu-skills · by JimLiuGenerate professional infographics with 21 layout types and 22 visual styles. Analyzes content, recommends layout×style combinations, and generates publication-ready infographics. Use when user asks to create "infographic", "信息图", "visual summary", "可视化", or "高密度信息大图".★ 26.6k GitHub stars