wechat-article-formatterlisted
Install: claude install-skill iamzifei/wechat-article-formatter-skill
# WeChat Article Formatter & Publisher
Format markdown articles with bm.md styling and publish directly to WeChat Official Account drafts via the official API.
## Overview
1. Read markdown file (typically `wechat.md` from article directory)
2. Upload local images to WeChat CDN via `media/uploadimg` API
3. Replace local image paths with WeChat CDN URLs in markdown
4. Render markdown to styled HTML via bm.md API with custom CSS
5. Publish to WeChat draft via official `draft/add` API
**CRITICAL**: Do NOT use third-party publishing APIs (e.g. 微绿 `wechat-publish`). They strip inline CSS styles. Always use WeChat's official `draft/add` API directly.
## Credentials
Read from `~/.env`:
| Variable | Purpose |
|----------|---------|
| `WECHAT_APP_ID` | WeChat Official Account AppID |
| `WECHAT_APP_SECRET` | WeChat Official Account AppSecret |
If not found, prompt the user to provide them and save to `~/.env`.
## Workflow
### Step 1: Identify Input
The user provides a markdown file path (e.g. `wechat.md` in an article directory).
Detect the article directory to find:
- `promotion.md` → extract digest/summary
- `_attachments/` → local images
- Brand config from the conversation context → author name
### Step 2: Get WeChat Access Token
```python
params = urlencode({
'grant_type': 'client_credential',
'appid': WECHAT_APP_ID,
'secret': WECHAT_APP_SECRET
})
# GET https://api.weixin.qq.com/cgi-bin/token?{params}
```
If error `40164` (IP not in whitelist), instruct u