SuperAPI AI Directory

self-media-wechat-publisher

Office & productivity

View repository

Updated 10-16 01:33

About this skill

Official Account Publishing

Objective

Typeset the confirmed WeChat official account final draft Markdown into platform-native rich text, and write it together with the cover and in-article images into the WeChat official account draft box. Only creates drafts, never mass-sends.

Adapter Layer Description

This module is the publishing adapter layer for the WeChat official account channel, based on the open-source tool wenyan CLI(Apache-2.0). When wenyan is unavailable, it does not block the creation workflow; deliver a manual publishing package according to self-media-content-delivery .

Pre-check

  1. wenyan --version Confirm installation. If not installed, prompt npm install -g @wenyan-md/cli; if the user does not want to install, directly deliver a manual publishing package.
  2. Confirm that WECHAT_APP_ID and WECHAT_APP_SECRET environment variables exist. Only determine existence; do not read, echo, or write to any file.
  3. Before the first publish, confirm that the IP of the running machine has been added to the WeChat official account backend allowlist. For scenarios with frequent IP changes or team collaboration, use server mode, see wenyan-setup.md。

Input Contract

The article must have frontmatter at the top:title is required;cover is a local or network path; if omitted, automatically take the first image in the body;author and source_url are optional. In-article images support local absolute paths, relative paths, and network addresses, and are automatically uploaded to the WeChat official account material library when publishing. For the template, see wechat-article-template.md。

Xiaolvshu image message: set frontmatter type: image to automatically extract all images in the body, or manually list image_list. Maximum 20 images; the first image is the cover.

Theme Selection

  1. Preferentially read the default typesetting theme in the account style profile.
  2. When there is no default theme or the user requests a style change, use the current article to render candidate themes and generate local previews (wenyan render -f 文章.md -t 主题), letting the user compare and choose.
  3. After the user selects, write it into the account style profile and continue using it subsequently without asking repeatedly.
  4. When branded typesetting is needed, use -c to load a custom CSS theme.

Publishing Workflow

Two layers of authorization are indispensable: final draft confirmation, plus draft box write authorization.

  1. Check that the frontmatter is complete, the cover is usable, and all in-article image paths are valid.
  2. wenyan render Render locally, confirming there is no garbled text and that code blocks and tables are readable.
  3. wenyan publish -f 文章.md -t 主题 -h 高亮主题 Write into the draft box.
  4. Remind the user to open the draft in the WeChat official account backend and check the title, cover, first two paragraphs, number of images, and external links.
  5. Write the draft creation time, theme used, and check results back into the task card.

When publishing fails, troubleshoot according to wenyan-setup.md . Do not blindly retry the same error more than once; credential-related issues are handed over to the user.

Multiple Accounts

When publishing to multiple WeChat official accounts, switch to wenyan's credential configuration to manage multiple accounts, and add --app-id when publishing to specify. Each account requires an independently configured IP allowlist.

Security Boundaries

  • Only write to the draft box; do not call the mass-send API.
  • Credentials are provided only via environment variables or wenyan credential configuration, and are not written into task cards, articles, logs, or repositories.
  • Do not record or relay token or key fragments that appear in command output.
  • Stop immediately and hand over to the user when a publishing API reports an error, whitelist interception occurs, or credentials become invalid.

Output

Return: draft title, theme used, cover source, number of images, draft creation time, and a checklist requiring manual verification.