跪拜 Guibai
← Back to the summary

AI Agent Writes and Publishes to WeChat Official Account: A Full Walkthrough with Zhiyu and baoyu-skills

Hello everyone, I'm Shuangyue. Author of wangEditor, former senior front-end engineer at Baidu and Didi, elite lecturer at Muke.com, PMP, author of Front-end Interview Pie.

I am developing an AI Agent project Zhiyu — an AI Agent personal assistant, similar to Openclaw Xiaolongxia. It includes tools, skills, memory, context, permission, subagent, session, command, hook, MCP-server... You can follow the project process for free, or join the project to learn and develop. If interested, DM me~

This article documents my entire process of using Zhiyu + baoyu-skills to have AI write illustrated blog posts and publish them to WeChat Official Account. A reference for AI Agent learners and users.

Installation and Initialization

Refer to Zhiyu's official website and documentation https://zhitalk.chat/ , install zhitalk globally via NPM

npm i zhitalk -g

Then execute the zhitalk command in the console. The first execution will trigger an initialization process:

image.png

Then follow its prompts, open the zhitalk.json configuration file, and write the necessary configuration. Refer to documentation https://zhitalk.chat/#config For example, I use the Kimi large model. My configuration file is as follows. For other models, refer to documentation https://zhitalk.chat/#models

image.png

After modifying the configuration file, re-execute zhitalk and it will run normally. At this point you can chat with it freely.

image.png

Install baoyu-skills

baoyu-skills is a writing skill set for AI Agents, such as Claude Code, Codex, Openclaw, etc., and of course applicable to the [Zhiyu] project. Through baoyu-skills we can use AI to write, generate images, and automatically publish to WeChat Official Account.

Execute the following command in the console to install baoyu-skills

npx skills add jimliu/baoyu-skills

During installation, you will be asked which skills to install. Select all directly; having extra ones doesn't matter. Then, select the Openclaw installation method, because [Zhiyu]'s skills directory references Openclaw. Installation completes quickly, as shown below. PS. If it fails, it's likely due to your local network being unable to access GitHub.

image.png

Because the Openclaw installation method was chosen, skills will be installed to the ~/.agents/skills directory

image.png

Execute the zhitalk command and ask it how many skills it has. It will list all baoyu-skills, indicating successful loading.

image.png

Generate WeChat API Key

You must first register your own WeChat Official Account, then log in to WeChat Developer Platform. Here you can see your AppID and AppSecret. Keep them confidential and do not commit them to GitHub. Then add your computer's IP (you can check it here https://ip.xxir.com/ ) to the API IP whitelist.

image.png

Create a new file ~/.baoyu-skills/.env on your computer and write your AppID and AppSecret

WECHAT_APP_ID=xxx
WECHAT_APP_SECRET=xxx

Publish to WeChat Official Account

For the first test, keep it as simple as possible, eliminating unnecessary distractions and steps, testing only the core functionality. Prepare a text file shui-diao-ge-tou.md containing Su Shi's "Prelude to Water Melody - When Will the Moon Be Clear and Bright". Download a random image sushi.jpg and store it on the desktop. These are the raw materials.

Run zhitalk and input the following:

I want to publish an article to WeChat Official Account. The content is in shui-diao-ge-tou.md on the desktop, and the cover image is sushi.jpg on the desktop.

zhitalk completes publishing quickly. Its process is as follows:

image.png

Open WeChat Official Account and you can see the draft. Publishing succeeded, core flow is working — a perfect first step!

image.png

AI Generate Images

In the test above, both content and images were local. In real AI writing, content is generated by AI. AI generating text is fine, but what about AI generating images?

baoyu-skills supports many AI image generation methods, multiple large models. Among them, Alibaba Cloud's DASHSCOPE is accessible from domestic networks and has free trial quotas, making it suitable for learning. Modify .baoyu-skills/.env to add DASHSCOPE_API_KEY. Go to Alibaba Bailian Platform to generate an API key.

DASHSCOPE_API_KEY=xxx 

Execute zhitalk to test. The input must include the keyword "Official Account".

Generate a cover image with the theme of SpaceX Starship. I will use it to publish to WeChat Official Account.

zhitalk performed the following steps:

image.png

After I confirmed, zhitalk loaded skill baoyu-image-gen and called the large model API to generate the image.

image.png

Open the image locally — it meets expectations. The AI image generation flow works. Another smooth step.

image.png

Complete Flow

All core parts above are working. Now try a complete example, letting AI generate everything and publish to the Official Account. Execute zhitalk and input the following:

I want to write an article to publish to WeChat Official Account. The topic is "Which industries will AI Agents change in the future?", around 2000 words. Identify 4-5 industries and provide sufficient reasons. Insert 2-3 related images within the article, rich with pictures and text, easy to read. You generate the cover image. The article style theme should be modern, not cliché. Author: Shuangyue

zhitalk went through a series of operations: wrote the article, generated images, published the article, and finally succeeded. The draft is also in the Official Account draft box.

image.png

But I found a problem: after opening the article, there was only text, no images. The cover image was fine. Let zhitalk check. Continue inputting:

The article was published successfully. Title, cover, and content are all there. However, the article content only has text, no images. Please check again.

zhitalk quickly found the problem and re-modified the article content, this time embedding the images, as shown below.

image.png

After re-publishing and checking the article, the images were there. zhitalk solved the problem in one go, very efficiently.

image.png

Finally

Zhiyu is a general-purpose AI Agent. baoyu-skills is a collection of general, standardized skills. Both are universal and standard, so naturally they can be used together. If you also want to develop an AI Agent from scratch, a Zhiyu project, you can DM me~