| name | wechat-publish |
| description | Publish articles to WeChat Official Account drafts via proxy server. This skill should be used when the user asks to publish/发布/push/post an article to 公众号/微信/WeChat. The workflow: format HTML with WeChat-compatible inline CSS → POST to 8899 /api/publish_ext. Only account "default" (工程人的智库) is available; other accounts are blocked by IP whitelist.
|
| agent_created | true |
WeChat Official Account Publisher
Publish articles to WeChat Official Account draft box via the 8899 proxy server.
Prerequisites
- Proxy server
119.29.168.239:8899 must be reachable
- Only account
default (工程人的智库) works
everyday and helper accounts are blocked by WeChat IP whitelist (40164)
Publish Workflow
1. Format HTML for WeChat
Use WeChat-compatible inline CSS. The HTML must be a self-contained snippet (no <html>, <head>, <body> tags).
Required style conventions:
- Font:
-apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif
- Font size: 15px
- Line height: 1.75
- Color: #333333
- Headings: use
<h2>/<h3> with left border accent (#0F4C81)
- Code blocks: dark background (#2d2d2d), light text
- Quotes: left border with light blue background (#F0F4F8)
- Tables: full width, header row with #0F4C81 background
2. Publish via API
POST to http://119.29.168.239:8899/api/publish_ext with JSON body:
{
"account": "default",
"title": "文章标题",
"content": "<section>...HTML content...</section>",
"thumb_media_id": "",
"thumb_base64": ""
}
Cover image options (pick one):
thumb_media_id: WeChat permanent material media_id (requires pre-upload via 8898 material API)
thumb_base64: Base64-encoded image data (PNG/JPG) — preferred, no pre-upload needed
Use scripts/publish.py for a one-shot publish:
python scripts/publish.py --title "标题" --html article.html [--account default]
Or inline:
import urllib.request, json
with open('article.html', 'r', encoding='utf-8') as f:
content = f.read()
payload = json.dumps({
'account': 'default',
'title': 'Article Title',
'content': content,
'thumb_media_id': ''
}, ensure_ascii=False).encode('utf-8')
req = urllib.request.Request(
'http://119.29.168.239:8899/api/publish_ext',
data=payload,
headers={'Content-Type': 'application/json; charset=utf-8'},
method='POST'
)
with urllib.request.urlopen(req, timeout=30) as r:
result = json.loads(r.read())
print(result)
3. Response
| Field | Meaning |
|---|
media_id | Draft ID in WeChat draft box |
account | Confirmed account name |
errcode: 40164 | IP whitelist error — this account's server IP is not whitelisted |
Account Mapping
| account param | Name | Status |
|---|
default | 工程人的智库 | ✅ Available |
everyday | 工程人的每一天 | ❌ IP whitelist (40164) |
helper | 工程人的助手 | ❌ IP whitelist (40164) |
Cover Images (thumb_media_id)
To add a cover image, first upload via the material API through 8898 proxy, then pass the media_id as thumb_media_id:
curl -F media=@cover.jpg "http://119.29.168.239:8898/wxapi/material/add_material?type=image&access_token=YOUR_TOKEN"
This requires obtaining an access_token first through the 8898 proxy with valid APPID/APPSECRET.