SuperAPI AI Directory

wechat-mp-publisher

Marketing & growth

View repository

Updated 10-15 08:06

About this skill

Intelligent Publishing for WeChat Official Accounts

⚠️ Important: Confirm the workflow before publishing

Before clicking Save Draft/Mass Send, you must perform the following steps:

  1. Screenshot confirmation: After all content (title, summary, body, cover) is filled in,you mustuse browser(action="screenshot") to screenshot the current editing page
  2. Send to group: Send the screenshot to the group (telegram group: -1003890797239) for Daniel to confirm
  3. Wait for confirmation:Do not publish automatically, you must wait for the user to confirm in the group with "可以发布" or a similar explicit instruction
  4. Execute publishing: Only after receiving confirmation, click the "Save Draft" or "Mass Send" button

🚫 Warning: Do not click the publish button before receiving confirmation!

Formatting Rules

Item Rule
Title ≤64 characters, 13-22 characters recommended, use emoji sparingly
Summary ≤120 characters; if left blank, the first 54 characters of the body are used
Body ≤20,000 characters, 1500-3000 characters recommended
Font size Body 15px, title 18-22px
Color Body #3f3f3f (not pure black), quote #8c8c8c
Line spacing 1.75x, paragraph spacing 15px
Margins 15-20px
Lead image 900×500px (headline), core content centered
Secondary image 200×200px
Inline images Width 640px to fit mobile phones, one image every 300-500 characters
emoji ⚠️ Use sparingly; some clients display abnormally

Content Adaptation Templates

When converting any content into Official Account format:

  1. Title: 13-22 characters optimal, formula options:

    • Number impact:7个AI工具让你效率翻倍
    • Suspense hook:最后一个太强了!
    • Contrast:10小时→10分钟
  2. Formatted HTML styles:

    <section style="font-size:15px;color:#3f3f3f;line-height:1.75;letter-spacing:1px;padding:0 15px;">
      <h2 style="font-size:20px;font-weight:bold;color:#1a1a1a;margin:30px 0 15px;">标题</h2>
      <p style="margin-bottom:15px;">正文段落</p>
      <blockquote style="border-left:3px solid #07c160;background:#f7f7f7;padding:10px 15px;color:#666;font-size:14px;">
        引用块
      </blockquote>
      <p style="color:#888;font-size:12px;text-align:center;">图片说明</p>
    </section>
    
  3. Markdown→WeChat: Use mdnice.com conversion or the script's built-in converter

  4. Standard end-of-article template:

    ---
    👆 点击关注,每周更新
    💬 评论区聊聊你的看法
    👇 觉得有用?转发给朋友
    

Publishing Workflow

Complete workflow (including screenshot confirmation)

1. 接收任务 → 2. 填写内容 → 3. 截图确认 → 4. 等待Daniel确认 → 5. 发布

Step 1: Fill in content

Fill in all content using Browser automation or API methods (see the two methods below)

Step 2: Screenshot confirmation ⚠️

  • You mustexecute browser(action="screenshot") to capture the current editing page
  • Send the screenshot to the Telegram group (-1003890797239)
  • The screenshot should include: title, summary, body preview, cover image

Step 3: Wait for confirmation

  • Do not publish automatically
  • Explicitly wait in the group for user confirmation (e.g., "To confirm publishing, please reply '可以'")
  • Only continue after receiving explicit confirmation from Daniel

Step 4: Execute publishing

After receiving confirmation:

  • Draft mode: click "Save Draft"
  • Publish mode: click "Mass Send"

Method A: Browser automation (default)

python scripts/publish.py \
  --title "文章标题" \
  --content /path/to/article.md \
  --cover /path/to/cover.jpg \
  --digest "文章摘要120字以内" \
  --screenshots /tmp/wechat_screenshots

Browser mode features:

  • Requires WeChat QR code login (first time)
  • cookies are automatically saved to ~/.openclaw/skills/wechat-mp-smart-publish/cookies.json
  • Screenshot directory is optional, for debugging

Method B: API publishing (requires service account access_token)

python scripts/api_publish.py \
  --title "文章标题" \
  --content /path/to/article.html \
  --cover /path/to/cover.jpg \
  --digest "摘要"

API mode features:

  • Requires AppID + AppSecret
  • Cover image must be uploaded in advance as permanent material
  • Supports draft mode and publish mode

API endpoints:

  • Get Token:GET /cgi-bin/token
  • Upload material:POST /cgi-bin/material/add_material
  • Create draft:POST /cgi-bin/draft/add
  • Publish:POST /cgi-bin/freepublish/submit

Draft mode (default, safe)

All publishing defaults to --mode draft, after confirming in the draft box of the Official Account backend, then mass send.

Mass send mode

--mode publish mass sends directly.Warning: Subscription accounts have only 1 mass send opportunity per day, service accounts have 4 per month.

⚠️ Confirm publish example message

When sending to the group for confirmation, it is recommended to use the following format:

📝 文章预览

标题:xxx
摘要:xxx
封面:[截图]

请确认是否发布?回复「可以」或「再改改」

Error handling

Error Handling
Login expired Prompt to scan QR code again and save new cookie
Title exceeds 64 characters Truncate and warn
Cover size error Automatically adjust to 900×500
Images not displaying Check whether they are uploaded to the WeChat material library (external links unavailable)
Layout disorder Use inline style, do not rely on class
API rate limit Wait 60 seconds and retry, up to 3 times
Sensitive word interception Return the specific sensitive word location and prompt modification
Publishing without receiving confirmation 🚫 Serious error! Must re-execute the complete confirmation process

Pre-publish checklist

  • Title ≤64 characters
  • Summary ≤120 characters
  • Cover image 900×500px
  • Layout: 15px font size, #3f3f3f color, 1.75 line spacing
  • All images uploaded (external links unavailable)
  • No sensitive/prohibited words
  • Mobile preview is normal
  • Screenshot has been sent to the group awaiting confirmation
  • Publish only after receiving explicit confirmation from Daniel

File structure

wechat-mp-publisher/
├── SKILL.md                    # 本文件
├── scripts/
│   ├── publish.py              # Playwright 浏览器发布(默认)
│   └── api_publish.py          # API 发布(需access_token)
├── references/
│   └── platform-rules.md        # 完整平台规则
└── templates/
    ├── tech-article.html        # 技术文排版模板
    └── general-article.html     # 通用文排版模板