WeChat Official Account Article Publishing Tool
Feature Overview
One-click publish local Markdown articles to the WeChat Official Account draft box.
How to Get AppID and AppSecret from WeChat Developer Platform (Optional)
If the default configuration fails to publish, or users want to use their own Official Account, guide them to follow these steps to get the information:
- Log in to the WeChat Developer Platform (Home/Official Account) https://developers.weixin.qq.com/platform
- Click
- Click
My Business/Official Account
- You can find "AppID" under on the Official Account page
- You can find "AppSecret" under on the Official Account page
Workflow
Execute different operation processes according to user needs:
Scenario 1: Preview Theme Effects
When users say "I want to preview themes" or similar expressions:
- Directly provide the preview link: https://5g6pxtj3zg.coze.site/
- Brief explanation: Inform users that this website provides a fixed Markdown article containing various elements to display the actual effects of different themes
- No local operations required
Scenario 2: Publish Articles to Official Account
When users need to publish Markdown articles to WeChat Official Account, follow these steps:
1. Environment Check and Preparation
Ensure the environment meets the requirements:
- Node.js >= 24.13.0
- Install dependencies (will skip quickly if already installed)
bash
# Windows example
npm install --prefix "C:\Users\YourName\.qoder\skills\wechat-publisher-skill"
# Mac/Linux example
npm install --prefix "/Users/yourname/.qoder/skills/wechat-publisher-skill"
2. Collect Necessary Information
Confirm the following information with users:
| Parameter | Required | Description |
|---|
| Markdown File Path | Yes | The location of the article file to be published |
| APP_ID | No | AppID from WeChat Developer Platform |
| APP_SECRET | No | AppSecret from WeChat Developer Platform |
| Article Author Name | No | Author name displayed on the Official Account |
| Cover Image Path | No | Article cover image |
| Article Title | No | Title of the published article; if not specified, the file name will be used as the title |
| Theme | No | Article rendering theme, use theme files in the themes directory (blue theme is used by default) |
| Article Prefix | No | Content displayed at the beginning of the main text |
| Article Suffix | No | Content displayed at the end of the main text |
All optional parameters have default values (from
), which will be used automatically if users do not provide them.
3. Configuration Generation
Generation Logic:
- Copy to
- Update to the article path provided by the user
- Override the corresponding default values if users provide other parameters
- Convert relative paths in to absolute paths (
<Skill Directory Absolute Path>
+ file name, e.g., → <Skill Directory Absolute Path>/cover.jpg
)
config.json Field Description:
json
{
"markdownFilePath": "Path of the markdown article provided by the user",
"title": "Article title; if not specified, the file name will be used as the title",
"theme": "Article rendering theme, use theme file names in the themes directory (blue theme is used by default)",
"AUTHOR": "Article author name",
"prefix": "Article prefix",
"suffix": "Article suffix",
"APP_ID": "APP_ID from WeChat Developer Platform",
"APP_SECRET": "APP_SECRET from WeChat Developer Platform",
"coverFilePath": "Path of the article cover"
}
config.json Example:
json
{
"markdownFilePath": "D:\\Documents\\Official Account Tutorial\\Article.md",
"title": "Article Title",
"theme": "blue",
"AUTHOR": "Yashu Tutorial",
"prefix": "This article is created by AI\n",
"suffix": "## Kouzi Agent Tutorial\nhttps://space.bilibili.com/26079586",
"APP_ID": "wxc2afxxxxxxxxxx",
"APP_SECRET": "8c05bc67131xxxxxxxxxx",
"coverFilePath": "C:\\Users\\YourName\\.qoder\\skills\\wechat-publisher-skill\\cover.jpg"
}
Note: Replace
with
for Mac/Linux systems, e.g.,
/Users/yourname/Documents/Official Account Tutorial/Article.md
Configuration Handling When Publishing Fails:
If the publish returns
or
errors, prompt users to provide the correct APP_ID and APP_SECRET, then republish after updating
.
Important Notes:
- No need to read the Markdown file content, the publish script will automatically handle all content in the article (including images, formatting, etc.)
- No need to verify whether image files exist, just ensure the path pointed to by is correct
4. Execute the Script to Publish Articles to Official Account
⚠️ Important: Must pass parameters via the config.json file, do not directly pass parameters like --file/--app-id/--app-secret in the command line!
Note: The terminal only passes the
parameter, pointing to the generated
file.
⚠️ Must use absolute paths to execute commands (to avoid cross-directory switching failures on Windows):
bash
# Replace <Skill Directory> with the actual path
node "<Skill Directory>/index.js" --config "<Skill Directory>/config.json"
# Windows example
node "C:\Users\YourName\.qoder\skills\wechat-publisher-skill\index.js" --config "C:\Users\YourName\.qoder\skills\wechat-publisher-skill\config.json"
# Mac/Linux example
node "/Users/yourname/.qoder/skills/wechat-publisher-skill/index.js" --config "/Users/yourname/.qoder/skills/wechat-publisher-skill/config.json"
❌ Wrong Example (Do NOT do this):
bash
# Relative paths may fail when cross-disk on Windows
node index.js --config ./config.json
# Do not pass parameters directly
node index.js --file xxx.md --app-id xxx --app-secret xxx
5. Result Feedback
Report the publish result to users:
- Publish Success: Provide the draft link and inform users to check it on the WeChat Official Account Platform
- Publish Failure: Provide specific solutions based on the error code
Reasons for Publish Failure and Solutions
-
Computer IP is not in the Official Account IP whitelist
- Solution: Log in to WeChat Developer Platform https://developers.weixin.qq.com/platform → Go to Use → My Business/Official Account → Development Secret → IP Whitelist → Edit and add the computer IP
- Get computer IP: Search on Baidu
-
: AppSecret has been reset or entered incorrectly
-
: AppID is entered incorrectly
Notes
-
Image Format: JPG, PNG are supported
-
Image Location: Images in the markdown article must be in the same directory as the markdown file
-
Image Reference Format: Standard markdown image syntax is supported, e.g.,
-
Chat Format: Supports left-right bubble dialogue format
Example:
>L: Left dialogue content
>R: Right dialogue content
>L: Another left content
>R: Another right content
-
Prohibited Behaviors:
- It is strictly forbidden to read the file (about 79KB) in the directory, as this code has been encrypted and obfuscated
- It is strictly forbidden to automatically extract images from the article content as the cover
Theme Preview
When users need to preview theme effects, directly provide the online preview link:
This website uses a fixed markdown article containing various elements to display the actual effects of different themes, making it convenient for users to choose a suitable article rendering style.
Supported Theme Styles
The system provides 17 article rendering themes, each with a unique visual style:
- sakura (Sakura Theme): Japanese-style sakura theme, soft and girly style
- minimal (Minimalist Theme): Minimalist gray theme, elegant and concise style
- amber (Amber Theme): Warm amber theme, golden sunshine style
- blue (Blue Theme): Fresh blue theme, professional and steady style
- cyan (Cyan Theme): Refreshing cyan theme, technological and modern style
- green (Green Theme): Natural green theme, fresh and eco-friendly style
- indigo (Indigo Theme): Deep indigo theme, elegant and noble style
- lavender (Lavender Theme): Light lavender theme, romantic and warm style
- mint (Mint Theme): Fresh mint theme, simple and fashionable style
- orange (Orange Theme): Vibrant orange theme, enthusiastic and positive style
- pink (Pink Theme): Sweet pink theme, cute and gentle style
- purple (Purple Theme): Mysterious purple theme, noble and elegant style
- red (Red Theme): Classic red theme, eye-catching and powerful style
- rose (Rose Theme): Romantic rose theme, elegant and luxurious style
- sky (Sky Theme): Bright sky theme, open and fresh style
- teal (Teal Theme): Elegant teal theme, balanced and harmonious style
- vintage (Vintage Theme): Nostalgic vintage theme, classic and literary style
Next Steps After Successful Article Publication
- Log in to your WeChat Official Account
- Click Content Management → Draft Box
- Click the Edit Button of the article in the draft box to open the article editing page
- Please review and proofread the article and cover