Post image-text messages with multiple images to WeChat Official Account.
Note: WeChat has renamed "图文" to "贴图" in the Official Account menu (as of 2026).
Post with images and markdown file (title/content extracted automatically)
${BUN_X} ./scripts/wechat-browser.ts --markdown source.md --images ./images/Post with explicit title and content
${BUN_X} ./scripts/wechat-browser.ts --title "标题" --content "内容" --image img1.png --image img2.pngSave as draft
${BUN_X} ./scripts/wechat-browser.ts --markdown source.md --images ./images/ --submit
| Parameter | Description |
|-----------|-------------|
| --markdown | Markdown file for title/content extraction |
| --images | Directory containing images (sorted by name) |
| --title | Article title (max 20 chars, auto-compressed if too long) |
| --content | Article content (max 1000 chars, auto-compressed if too long) |
| --image | Single image file (can be repeated) |
| --submit | Save as draft (default: preview only) |
| --profile | Chrome profile directory |
When using --markdown, the script:
1. Parses frontmatter for title and author:
---
title: 文章标题
author: 作者名
---
2. Falls back to H1 if no frontmatter title:
# 这将成为标题
3. Compresses title to 20 characters if too long: - Original: "如何在一天内彻底重塑你的人生" - Compressed: "一天彻底重塑你的人生"
4. Extracts first paragraphs as content (max 1000 chars)
When using --images :
- All PNG/JPG files in directory are uploaded
01-cover.png, 02-content.png, etc.| Field | Max Length | Notes |
User: /post-to-wechat --markdown ./article.md --images ./xhs-images/Claude:
1. Parses markdown meta:
- Title: "如何在一天内彻底重塑你的人生" → "一天内重塑你的人生"
- Author: from frontmatter or default
2. Extracts content from first paragraphs
3. Finds 7 images in xhs-images/
4. Opens Chrome, navigates to WeChat "图文" editor
5. Uploads all images
6. Fills title and content
7. Reports: "Image-text posted with 7 images."
| Script | Purpose |
|--------|---------|
| wechat-browser.ts | Main image-text posting script |
| cdp.ts | Chrome DevTools Protocol utilities |
| copy-to-clipboard.ts | Clipboard operations |