SuperAPI AI Directory

wechat-publisher

General & other

View repository

Updated 10-16 08:33

About this skill

WeChat Publisher Skill

Version History

Version Date Update Content
v1.4.0 2026-04-06 Initial release
v1.5.0 2026-04-16 Added practical experience with API publishing, Chinese font support, and IP whitelist solutions
v1.6.0 2026-04-16 Removed hardcoded AppID for security and desensitization
v1.7.0 2026-04-16 Added experience with AI Agent article creation and multi-model parallel workflows

I. Practical Experience with WeChat Official Account API Publishing (2026-04-16)

1.1 IP Whitelist Issue

Problem Description:

  • Miaoda Cloud Computer uses a dynamic IP (Alibaba Cloud), and the IP changes
  • WeChat Official Account API calls require the IP to be in the whitelist
  • Directly calling the API from the server will fail:invalid ip 39.102.54.62, not in whitelist

Solution:

Solution A: Obtain access_token through a browser (recommended)

# 在浏览器中打开以下 URL(替换 appid 和 secret):
https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=你的AppID&secret=你的AppSecret

# 浏览器会返回 JSON 格式的 access_token
# 复制返回结果中的 access_token 值

Solution B: Configure the IP whitelist

  • Add possible IP addresses in the Official Account backend
  • Note: The server IP may be dynamic, so multiple possible IPs need to be added
  • Current Miaoda Cloud Computer IP:39.102.54.62、39.97.255.102(may change)

1.2 Cover Image Generation (Chinese Support)

Problem Description:

  • The server's default font does not support Chinese, causing the generated cover image text to appear as garbled squares
  • A font that supports Chinese is needed

Solution:

# 1. 先检查可用中文字体
fc-list :lang=zh

# 2. 推荐使用 Noto Sans CJK 字体
# 字体路径:/usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc

# 3. Python PIL 示例代码
from PIL import Image, ImageDraw, ImageFont

img = Image.new('RGB', (900, 383), color='#06b6d4')
draw = ImageDraw.Draw(img)
font = ImageFont.truetype('/usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc', 56)
draw.text((450, 191), '标题文字', fill='white', anchor='mm', font=font)
img.save('cover.png')

1.3 Complete Draft Publishing Process

Step 1: Obtain access_token (through a browser)

1. 浏览器打开:https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=你的AppID&secret=你的AppSecret
2. 复制返回的 access_token(有效期 2 小时)

Step 2: Upload the cover image to obtain media_id

# 使用 curl 上传图片
curl -s "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=你的TOKEN&type=thumb" \
  -F "media=@cover.png;type=image/png"

# 返回示例:
# {media_id":"vMrq-mSP3SIFyZbOzk_6TkpzzT22KaGPI6r5tTivqFzaskMCnN_U5F4-54CQ38VU",...}

Step 3: Create a draft article

curl -s "https://api.weixin.qq.com/cgi-bin/draft/add?access_token=你的TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "articles": [{
      "title": "文章标题",
      "author": "作者",
      "content": "<p>文章内容(HTML格式)</p>",
      "digest": "摘要",
      "thumb_media_id": "封面图media_id",
      "need_open_comment": 0,
      "only_fans_can_read": 0
    }]
  }'

1.4 Common Error Handling

Error Code Error Message Solution
40164 invalid ip not in whitelist Obtain the token through a browser, or add the IP to the whitelist
40007 invalid media_id You must first upload a cover image to obtain media_id; it cannot be empty
40137 invalid image format Image format issue; ensure it is in PNG/JPG format

II. AI Agent Article Creation Workflow (New on 2026-04-16)

2.1 Multi-Model Parallel Search Strategy

Core Idea: Use multiple AI models to search in parallel to improve information coverage and timeliness

# 并行搜索多个主题
web_search "Agent AI 人工智能 2026年4月 最新技术 新闻"
web_search "OpenClaw GitHub 2026年4月 AI Agent 开源"
web_search "Claude Anthropic 2026年4月 最新动态"

Search Result Integration:

  • Extract key information from multiple search results
  • Cross-verify the accuracy of the information
  • Prioritize first-hand information sources (official announcements, technical blogs)

2.2 Article Structure Design

Standard Structure for In-Depth Analysis Articles:

一、事件/现象级概述
   - 核心事件回顾
   - 数据支撑(用户量、下载量、市场占有率等)

二、技术原理深度剖析
   - 核心技术解读
   - 与竞品的技术对比

三、行业影响分析
   - 对既有格局的冲击
   - 新机会点识别

四、实操指南/应用场景
   - 普通人如何应对
   - 企业如何布局

五、未来展望
   - 趋势判断
   - 行动建议

2.3 Viral Title Formulas

Formula: Year + Core Event + Suspense/Emotional Word

Excellent Title Examples:

  • "2026 AI Agent Explosion: The Leap from 'Answering Questions' to 'Completing Tasks'"
  • "Claude Suddenly Requires ID Verification! The Era of AI Real-Name Systems Has Officially Arrived"
  • "310,000 Stars! In-Depth Analysis of the Hottest Open-Source AI Tool of 2026"

2.4 Key Points for Long-Form Writing

Key Points for an 8,000-Word In-Depth Article:

  • At least 500 words of detailed elaboration for each core viewpoint
  • Cite real data and cases
  • Include comparison tables and schematic diagrams (simulated with HTML/CSS)
  • Provide actionable recommendations
  • End with a memorable quote that elevates the theme

2.5 Multi-model collaborative workflow

Recommended tool combinations:

Scenario Recommended model Reason
News search MiniMax M2.7 Strong timeliness, multilingual search
Deep analysis GLM-5.1 Strong long-text comprehension
Content creation Miaoda Flash Fast, suitable for first drafts
Title optimization Qwen3.6 Good Chinese language feel

III. WeChat Official Account Article Format Standards

3.1 Key Points for Format Preservation

Key points for preserving WeChat Official Account article format:

  • ❌ WeChat editor filters out <style> tags
  • ❌ WeChat editor filters out class attributes
  • ✅ WeChat editor preservesinline styles style="..."
  • ✅ WeChat editor preserves basic HTML tags

Key points for list format:

  • ❌ Do not use <ul>/<li> lists (will produce extra black dots)
  • ✅ Use • + regular <p> paragraphs

3.2 Complete Template Structure

<!DOCTYPE html>
<html>
<body style="font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif; font-size: 15px; line-height: 1.6; color: #333; max-width: 640px; margin: 0 auto; padding: 20px;">

<!-- 标题 -->
<h1 style="font-size: 24px; font-weight: bold; color: #1a1a1a; margin-bottom: 8px;">文章标题</h1>
<p style="color: #999; font-size: 13px; margin-bottom: 20px;">日期 · 分类</p>

<!-- 标签(圆角胶囊) -->
<span style="display: inline-block; background: #e0f7fa; color: #06b6d4; padding: 2px 10px; border-radius: 20px; font-size: 13px; margin-right: 6px;">标签1</span>

<!-- 引言(青色左边框) -->
<p style="font-size: 16px; color: #555; margin: 20px 0; border-left: 4px solid #06b6d4; padding-left: 14px;">引言内容</p>

<!-- 二级标题 -->
<h2 style="font-size: 18px; font-weight: bold; color: #222; margin: 28px 0 14px; border-left: 4px solid #06b6d4; padding-left: 10px;">标题</h2>

<!-- 列表(用 • 符号,不用 <ul>/<li>) -->
<p style="margin: 8px 0; color: #444;">• 列表项1</p>
<p style="margin: 8px 0; color: #444;">• 列表项2</p>

<!-- 引用块 -->
<div style="background: #f0f9fa; border-left: 4px solid #06b6d4; padding: 12px 14px; margin: 16px 0; font-style: italic; color: #555;">
<p style="font-style: normal; color: #333;">引用内容</p>
</div>

<!-- 卡片(浅色背景+圆角+边框) -->
<div style="background: #f8feff; border-radius: 10px; padding: 14px; margin: 14px 0; border: 1px solid #cce8f0;">
<p style="font-weight: bold; color: #0891b2; font-size: 14px;">卡片标题</p>
<p style="color: #555; font-size: 13px;">卡片内容</p>
</div>

<!-- 警告块 -->
<div style="background: #fff8e1; border-left: 4px solid #ffc107; padding: 10px 14px; margin: 12px 0; font-size: 14px; color: #795548;">
<p style="margin: 0;">⚠️ 警告内容</p>
</div>

<!-- 双栏对比 -->
<div style="display: flex; gap: 12px; margin: 12px 0;">
<div style="flex: 1; background: #f8feff; border-radius: 10px; padding: 14px; border: 1px solid #cce8f0;">
<p style="font-weight: bold; color: #0891b2;">左栏标题</p>
<p style="color: #555; font-size: 12px;">左栏内容</p>
</div>
<div style="flex: 1; background: #fff5f5; border-radius: 10px; padding: 14px; border: 1px solid #ffcdd2;">
<p style="font-weight: bold; color: #c62828;">右栏标题</p>
<p style="color: #555; font-size: 12px;">右栏内容</p>
</div>
</div>

<!-- 签名 -->
<div style="text-align: center; color: #999; font-size: 13px; margin-top: 30px; padding-top: 16px; border-top: 1px solid #eee;">
<p>关注我,持续分享 👇</p>
<p style="color: #07c160; margin-top: 8px;">公众号名称</p>
</div>

</body>
</html>

IV. Configuration (first-time use)

Security tip: credentials are passed via environment variables, do not hardcode!

export WECHAT_APP_ID="你的AppID"
export WECHAT_APP_SECRET="你的AppSecret"

How to obtain: WeChat Official Platform backend → Settings and Development → Basic Configuration


V. Color Scheme (fixed style)

Purpose Color
Primary color (titles, tags, borders) #06b6d4 (cyan)
Title text #1a1a1a
Body text #444
Secondary text #888
Quote/card background #f0f9fa / #f8feff
Warning background #fff8e1
Code block background #1a1a2e
Code text #a5f3fc

VI. File Structure

wechat-publisher/
├── SKILL.md           # 本文档(v1.7.0)
└── publish.py         # 发布脚本(可选)

VII. Notes

  1. Cover image: must first be uploaded to WeChat permanent materials, obtain media_id, cannot be empty
  2. List: always use • + <p>, do not use <ul>/<li>
  3. Line spacing: fixed at 1.6
  4. Paragraph spacing: body text margin: 12px 0, lists margin: 8px 0
  5. Chinese font: use when generating cover images /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc
  6. access_token validity period: 2 hours, remember to refresh in time

VIII. Practical Cases (2026-04-16)

Case 1: Claude real-name system article

  • Topic: In-depth analysis of Anthropic Claude identity verification policy
  • Word count: 8000 words
  • Structure: 7 major chapters + FAQ
  • Publishing: successfully uploaded to drafts

Case 2: AI Agent outbreak article

  • Topic: In-depth analysis of the 2026 AI Agent outbreak
  • Word count: 8000 words
  • Structure: 10 major chapters
  • Source: latest news based on parallel searches by multiple AI models
  • Publishing: Successfully uploaded to drafts