- Content in the gray box = Copy and paste directly into the WorkBuddy dialog boxinstructions for
- Start from step one in order, and proceed to the next step only after completing each one
- Steps one through three only need to be done once (environment setup); after that, each publishing session only requires step four
- If you run into problems, see the FAQ at the bottom
Configure once, then everything is automated. Each time you want to publish, just say one sentence in WorkBuddy.
Step 1: Get WeChat Official Account API Keys
This is the most important step. You need to get two things from the WeChat Official Platform:AppID and AppSecret, which are equivalent to the Official Account's "username + password".
1.1 Log in to the Official Platform
Open your browser and visit:
https://mp.weixin.qq.com
Scan the QR code with the WeChat you bound to log in.
1.2 Go to Developer Settings
After logging in, follow this path to find the API keys:
- Left menu → Settings & Development → Basic Configuration
- Find "Developer ID (AppID)", clickCopyon the right, and save it
- Find "Developer Password (AppSecret)", clickReset(or view), scan the QR code with WeChat to confirm, then you can see the secret key; copy and save it
1.3 Set up the IP whitelist (important)
On the same "Basic Configuration" page, find IP whitelist, you need to add your computer's IP, otherwise the API will return an error.
Don't know your IP? Copy the following and send it to WorkBuddy:
帮我查一下我当前电脑的公网IP地址。
Step 2: Configure the Python publishing environment
Let WorkBuddy set up the entire environment for you with one-click. Copy the following and replace the AppID and AppSecret with your own:
帮我配置微信公众号自动发文环境: AppID:在这里填你的AppID AppSecret:在这里填你的AppSecret 公众号名称:在这里填公众号名称(比如:AI Growth) 作者名:在这里填作者名(比如:菠萝大队长) 请帮我: 1. 在 C:\Users\你的用户名\WorkBuddy\Claw\.workbuddy\ 目录下创建配置文件 wechat_config.env 2. 创建 Python 虚拟环境并安装所需依赖(requests、python-dotenv、Pillow) 3. 创建文章生成脚本 generate_article.py 4. 测试 API 连接是否正常
2.1 Verify the environment is ready
帮我检查微信公众号发文环境是否配置正常: 1. 检查配置文件是否存在 2. 测试用 AppID 和 AppSecret 获取 access_token 3. 告诉我结果
Step 3: Customize article content
Tell WorkBuddy what style and topic you want each article to have, and it will modify the script for you.
Option 1: Let WorkBuddy write it and put it in the script
帮我更新发文脚本 generate_article.py,写一篇新文章放进去: 主题:在这里写主题(比如:AI工具提效、职场干货、科技资讯) 风格:口语化,不要太正式,像朋友聊天那种 字数:不少于1500字 配图:每个章节一张,从 Unsplash 免费图库下载 结尾:加上一个"每日AI办公小技巧" 标题格式:【AI日报】+ 吸引人的副标题
Option 2: You write the body, let WorkBuddy format and publish it
If you've written the content yourself, just give it to WorkBuddy to format:
帮我把下面的文章发布到微信公众号草稿箱: 标题:在这里填标题 作者:在这里填作者名 正文: (在这里粘贴你的文章内容) 要求: - 排版简洁,重要信息用彩色背景框标出 - 每个章节加一张相关配图(从 Unsplash 下载) - 发布完告诉我草稿ID
Step 4: Publish the article to the drafts box (most commonly used!)
Once the environment is configured, each time you publish you only need to say this one sentence:
运行微信公众号发文脚本,把文章发布到草稿箱。
After publishing is complete, WorkBuddy will tell you the draft ID, like this:
# 发布成功示例输出
✓ 文章标题: 【AI日报】智能体时代来了
✓ 配图: 8 张上传成功
✓ 草稿添加成功!
media_id: rw_j-U8Z6aVEVxVEWyh9m...
Where can I see it after publishing?
Open mp.weixin.qq.com → Left menu → Content and Interaction → drafts box, find the article you just published, preview to confirm, then click Publish.
Step 5: Set up scheduled automatic publishing
Don't want to trigger it manually every time? Let WorkBuddy set up a scheduled task for you to automatically generate and send to the drafts folder every day.
帮我创建一个每天自动发文的定时任务: 发文时间:每天上午10点 内容主题:每日最新科技/AI资讯,每次写不同的内容不重复 文章风格:口语化,附配图,结尾有每日AI小技巧 发布到:AI Growth公众号草稿箱 作者:菠萝大队长
View and manage scheduled tasks
帮我查看当前有哪些自动化任务在运行。
暂停"每日公众号文章发布"这个自动化任务。
Step 6: Update AppSecret (when the key expires)
The WeChat Official Account AppSecret sometimes needs to be reset (for example, if you forget it or change it periodically for security). How to update:
更新微信公众号 AppSecret: AppID:在这里填AppID(不变) AppSecret:在这里填新的AppSecret
测试微信公众号 API 连接,确认新的 AppSecret 是否有效。
Common Commands Quick Reference
All the following commandscopy and paste directlyGo to the WorkBuddy chat box to use it:
| What you want to do | Copy this text |
|---|---|
| Publish an article to the drafts folder | 运行微信公众号发文脚本,把文章发布到草稿箱。 |
| Write an article on a new topic and publish it | 帮我写一篇关于"xxx"的文章,发布到公众号草稿箱。 |
| Check whether an article has been published today | 查看微信公众号今天是否已经发过文章。 |
| Update AppSecret | 更新AppSecret:新的密钥是 xxx |
| Test whether the API is working properly | 测试微信公众号 API 连接是否正常。 |
| View scheduled tasks | 查看当前有哪些自动化任务在运行。 |
| Pause scheduled publishing | 暂停每日公众号自动发文任务。 |
| Resume scheduled publishing | 恢复每日公众号自动发文任务。 |
| Modify article style/topic | 修改发文脚本,以后文章主题改为"xxx"。 |
| View publishing history | 查看微信公众号历史发文记录。 |
xxx Replace with your actual content and copy-paste it directly into the WorkBuddy chat box!
Advanced usage: more ways to use it
📅 Schedule posts for a specific date
帮我写一篇关于"在这里填主题"的文章,明天上午9点自动发布到公众号草稿箱。
📝 Specify a particular post format
帮我写一篇公众号文章并发布到草稿箱: 主题:在这里填主题 要求: - 标题加【AI日报】前缀 - 不少于2000字 - 8个章节,每章节一张配图 - 重要内容用彩色背景框标出 - 结尾加每日AI办公小技巧 - 风格:像朋友聊天,不要太正式
🖼️ Use your own images
帮我发布一篇公众号文章到草稿箱,使用这些图片作为配图: C:\Users\你的用户名\Desktop\封面图.jpg C:\Users\你的用户名\Desktop\内容图1.jpg 文章主题:在这里填主题
FAQ
❓ What if I get the error "invalid appsecret"?
This means the AppSecret is incorrect or has expired. Go to the WeChat Official Account Platform to reset the AppSecret, then update the configuration:
更新AppSecret:在这里填新的AppSecret
❓ What if I get the error "ip unauthorized"?
You need to add your current computer's IP to the whitelist on the WeChat Official Account Platform. First, check your IP:
帮我查一下我当前电脑的公网IP地址。
Once you have the IP, go to mp.weixin.qq.com → Settings and Development → Basic Configuration → IP Whitelist, enter the IP and save.
❓ The article was published successfully, but I can't find it in the drafts?
Wait a few seconds and refresh, or use the following command to check:
帮我查询微信公众号草稿箱最新的几篇文章。
❓ What if the image upload fails?
WeChat Official Account has image requirements: each image must not exceed 10MB, and the format must be JPG/PNG/GIF. If downloading an online image fails, you can ask WorkBuddy to use a backup image:
上次发文图片下载失败,帮我换一批备用配图重新运行。
❓ The scheduled task didn't run automatically?
- Check whether WorkBuddy is still running
- Check whether the computer is powered on and connected to the internet
- Copy the following command to check the task status:
检查每日公众号发文定时任务的状态,看看上次执行时间和下次执行时间。
❓ What if I don't want to post every day and only want to trigger it manually?
Just don't create a scheduled task. Each time you want to post, simply say:
运行微信公众号发文脚本,把文章发布到草稿箱。
❓ How do I change the default theme for each article?
修改发文脚本,把默认文章主题改为"在这里填新主题",风格改为"在这里填风格"。
| Configuration item | Description | Where to find it |
|---|---|---|
| AppID | The Official Account's unique identifier | mp.weixin.qq.com → Settings → Basic Configuration |
| AppSecret | API key (keep it secret!) | Same as above, click "Reset" to obtain |
| IP whitelist | IPs allowed to call the API | Same as above, enter your public IP |
| Config file path | Key storage location | .workbuddy\wechat_config.env |
| Publishing script path | Python script location | .workbuddy\generate_article.py |