| name | wechat-controller-skill |
| description | Use when sending WeChat messages, images, or posting to Moments (朋友圈). Triggers: '发微信', 'send WeChat message', '发朋友圈', 'post to Moments', 'send image to WeChat', 'WeChat screenshot', '给 X 发消息', '给 X 发图片'. |
wechat-controller
Automate WeChat (微信) on macOS via the wechat_controller Python library.
Requirements
- macOS with WeChat (微信) running and logged in
- Accessibility permission granted to the terminal
wechat_controller installed: pip install wechat-controller
cliclick installed: brew install cliclick
- For image operations:
Pillow installed (pip install Pillow)
- For Vision-based chat matching:
ANTHROPIC_API_KEY env var set
Quick Reference
| Operation | Method |
|---|
| Send text message | wc.send(chat_name, text) |
| Send image | wc.send_image(chat_name, image_path) |
| Post to Moments | wc.post(text, images, visibility) |
| Open Moments window | wc.open_moments() |
| Screenshot Moments | wc.screenshot(dest_path) |
Usage
from wechat_controller import WeChatController
wc = WeChatController()
wc.send("文件传输助手", "Hello from Python!")
wc.send_image("文件传输助手", "/path/to/image.png")
wc.post(text="Hello from Python! 🐍")
wc.post(text="Today's view", images=["/tmp/photo.jpg"])
wc.post(text="Draft", visibility="private")
wc.open_moments()
path = wc.screenshot("/tmp/moments.png")
Rules
- Default test target: Use
文件传输助手 for test sends unless the user specifies a different recipient.
chat_name must exactly match the WeChat display name.
- Chat search matches in priority order: 联系人 > 群聊 > 功能. Raises
ChatNotFound if no exact match.
- Moments visibility:
None (keep current) / "public" / "private".
- Max 9 images per Moments post (WeChat limit).
Exceptions
| Exception | Meaning |
|---|
WeChatNotRunning | WeChat not open — ask user to launch it |
ChatNotFound | Exact name not found in search results |
MediaError | Image file missing or unreadable |
MomentsWindowNotFound | Moments window didn't appear — call open_moments() first |
PostTimeout | Composer didn't close after posting |