wechat-publisher

Original🇨🇳 Chinese
Translated
1 scripts

Publish local Markdown articles to the WeChat Official Account draft box. Use this skill when users mention publishing articles to Official Accounts, uploading Markdown to WeChat Official Accounts, or needing to sync local articles to WeChat Official Accounts.

12installs
Added on

NPX Install

npx skill4agent add steelan9199/wechat-publisher-skill wechat-publisher

SKILL.md Content (Chinese)

View Translation Comparison →

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:
  1. Log in to the WeChat Developer Platform (Home/Official Account) https://developers.weixin.qq.com/platform
  2. Click
    Go to Use
  3. Click
    My Business/Official Account
  4. You can find "AppID" under
    Basic Information
    on the Official Account page
  5. You can find "AppSecret" under
    Development Secret
    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:
  1. Directly provide the preview link: https://5g6pxtj3zg.coze.site/
  2. Brief explanation: Inform users that this website provides a fixed Markdown article containing various elements to display the actual effects of different themes
  3. 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:
ParameterRequiredDescription
Markdown File PathYesThe location of the article file to be published
APP_IDNoAppID from WeChat Developer Platform
APP_SECRETNoAppSecret from WeChat Developer Platform
Article Author NameNoAuthor name displayed on the Official Account
Cover Image PathNoArticle cover image
Article TitleNoTitle of the published article; if not specified, the file name will be used as the title
ThemeNoArticle rendering theme, use theme files in the themes directory (blue theme is used by default)
Article PrefixNoContent displayed at the beginning of the main text
Article SuffixNoContent displayed at the end of the main text
All optional parameters have default values (from
config.default.json
), which will be used automatically if users do not provide them.

3. Configuration Generation

Generation Logic:
  1. Copy
    config.default.json
    to
    config.json
  2. Update
    markdownFilePath
    to the article path provided by the user
  3. Override the corresponding default values if users provide other parameters
  4. Convert relative paths in
    config.default.json
    to absolute paths (
    <Skill Directory Absolute Path>
    + file name, e.g.,
    ./cover.jpg
    <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
invalid appid
or
invalid appsecret
errors, prompt users to provide the correct APP_ID and APP_SECRET, then republish after updating
config.json
.
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
    markdownFilePath
    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
--config
parameter, pointing to the generated
config.json
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
      ip
      on Baidu
  • invalid appsecret
    : AppSecret has been reset or entered incorrectly
  • invalid appid
    : AppID is entered incorrectly

Notes

  1. Image Format: JPG, PNG are supported
  2. Image Location: Images in the markdown article must be in the same directory as the markdown file
  3. Image Reference Format: Standard markdown image syntax is supported, e.g.,
    ![](image-filename.png)
  4. 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
  5. Prohibited Behaviors:
    • It is strictly forbidden to read the
      index.js
      file (about 79KB) in the
      wechat-publisher-skill
      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:
🔗 Theme Preview URL: https://5g6pxtj3zg.coze.site/
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

  1. Log in to your WeChat Official Account
  2. Click Content ManagementDraft Box
  3. Click the Edit Button of the article in the draft box to open the article editing page
  4. Please review and proofread the article and cover