{"skill":{"slug":"ryan-wechat-mp","displayName":"微信公众号发布工具","summary":"Automate publishing WeChat Official Account articles with media upload, draft management, and publish status querying via WeChat MP API.","description":"# WeChat MP Publisher\n\nOpenClaw Skill for publishing articles to WeChat Official Account (微信公众号文章自动发布工具)\n\n## Description\n\nThis skill enables AI agents to publish articles to WeChat Official Accounts using the WeChat MP API. It supports:\n\n- AccessToken management with automatic caching and refresh\n- Media upload (images, thumbnails, videos)\n- Article draft creation and management\n- Publishing articles to followers\n- Querying publish status and drafts\n\n## Tools\n\n### wechat-mp-publish\n\nPublish a WeChat Official Account article (发布微信公众号文章)\n\n**Parameters:**\n- `title` (string, required): Article title (文章标题)\n- `content` (string, required): Article content in HTML format (正文内容，支持 HTML)\n- `cover_media_id` (string, required): Cover image media_id obtained from upload (封面图片素材 ID)\n- `author` (string, optional): Author name (作者名)\n- `digest` (string, optional): Article summary/abstract (文章摘要)\n- `content_source_url` (string, optional): Original source URL (原文链接)\n- `publish` (boolean, optional): Whether to publish immediately (default: true). Set to false to save as draft. (是否立即发布，false 则保存为草稿)\n\n**Returns:**\n```json\n{\n  \"success\": true,\n  \"message\": \"文章已创建并提交发布\",\n  \"data\": {\n    \"media_id\": \"draft media id\",\n    \"publish_id\": \"publish task id\"\n  }\n}\n```\n\n**Example:**\n```yaml\ntool: wechat-mp-publish\nparams:\n  title: \"我的第一篇文章\"\n  content: \"<p>这是一篇测试文章</p>\"\n  cover_media_id: \"MEDIA_ID_FROM_UPLOAD\"\n  author: \"张三\"\n  publish: true\n```\n\n---\n\n### wechat-mp-upload-media\n\nUpload media file to WeChat server (上传素材到微信服务器)\n\n**Parameters:**\n- `file_path` (string, required): Local file path to upload (本地文件路径)\n- `type` (string, optional): Media type - `image`, `thumb`, `voice`, `video` (default: `image`) (素材类型)\n\n**Returns:**\n```json\n{\n  \"success\": true,\n  \"message\": \"素材上传成功\",\n  \"data\": {\n    \"media_id\": \"uploaded media id\",\n    \"type\": \"image\",\n    \"created_at\": 1234567890\n  }\n}\n```\n\n**Example:**\n```yaml\ntool: wechat-mp-upload-media\nparams:\n  file_path: \"/path/to/image.jpg\"\n  type: \"image\"\n```\n\n---\n\n### wechat-mp-upload-cover\n\nUpload cover image (shortcut for thumb type upload) (上传封面图片)\n\n**Parameters:**\n- `file_path` (string, required): Local file path to cover image (封面图片路径)\n\n**Returns:**\n```json\n{\n  \"success\": true,\n  \"message\": \"封面上传成功\",\n  \"data\": {\n    \"media_id\": \"cover media id\"\n  }\n}\n```\n\n**Example:**\n```yaml\ntool: wechat-mp-upload-cover\nparams:\n  file_path: \"/path/to/cover.jpg\"\n```\n\n---\n\n### wechat-mp-query-drafts\n\nQuery draft list (查询草稿列表)\n\n**Parameters:**\n- `offset` (number, optional): Pagination offset (default: 0) (分页偏移量)\n- `count` (number, optional): Items per page, max 20 (default: 10) (每页数量)\n\n**Returns:**\n```json\n{\n  \"success\": true,\n  \"message\": \"获取草稿列表成功，共 5 条\",\n  \"data\": {\n    \"total_count\": 5,\n    \"item_count\": 5,\n    \"items\": [...]\n  }\n}\n```\n\n---\n\n### wechat-mp-query-publish-status\n\nQuery publish status by publish_id (查询发布状态)\n\n**Parameters:**\n- `publish_id` (string, required): Publish task ID returned from publish (发布任务 ID)\n\n**Returns:**\n```json\n{\n  \"success\": true,\n  \"message\": \"发布状态: 成功\",\n  \"data\": {\n    \"publish_id\": \"PUBLISH_ID\",\n    \"publish_status\": 0,\n    \"status_text\": \"成功\",\n    \"article_id\": \"ARTICLE_ID\",\n    \"article_detail\": {...}\n  }\n}\n```\n\n**Status codes:**\n- 0: Success (成功)\n- 1: Publishing (发布中)\n- 2: Original content review failed (原创审核失败)\n- 3: Failed (失败)\n\n---\n\n### wechat-mp-delete-draft\n\nDelete a draft by media_id (删除草稿)\n\n**Parameters:**\n- `media_id` (string, required): Draft media_id to delete (草稿素材 ID)\n\n**Returns:**\n```json\n{\n  \"success\": true,\n  \"message\": \"草稿删除成功\"\n}\n```\n\n## Configuration\n\nCreate a configuration file at `~/.openclaw/config/wechat-mp.json`:\n\n```json\n{\n  \"app_id\": \"your-wechat-app-id\",\n  \"app_secret\": \"your-wechat-app-secret\",\n  \"default_author\": \"默认作者名\",\n  \"access_token_cache_file\": \"~/.openclaw/.wechat_mp_token.json\"\n}\n```\n\nOr use environment variables:\n```bash\nexport WECHAT_MP_APP_ID=\"your-app-id\"\nexport WECHAT_MP_APP_SECRET=\"your-app-secret\"\nexport WECHAT_MP_DEFAULT_AUTHOR=\"默认作者\"\nexport WECHAT_MP_TOKEN_CACHE=\"~/.openclaw/.wechat_mp_token.json\"\n```\n\n## Prerequisites\n\n1. WeChat Official Account (Service Account/认证服务号) with API access\n2. IP whitelist configured in WeChat MP Admin Portal\n3. Node.js >= 18\n\n## Installation\n\n```bash\ncd /Users/zhizi/.openclaw/workspace/agents/dev-team/projects/active/wechat-mp-publisher\nnpm install\nnpm run build\n```\n\n## Usage Example\n\n### Complete workflow\n\n```typescript\n// 1. Upload cover image\nconst coverResult = await wechatMpUploadCover({\n  file_path: \"/path/to/cover.jpg\"\n});\n\n// 2. Publish article\nconst publishResult = await wechatMpPublish({\n  title: \"我的文章标题\",\n  content: \"<p>文章内容</p>\",\n  cover_media_id: coverResult.data.media_id,\n  author: \"作者名\",\n  publish: true\n});\n\n// 3. Check publish status\nconst status = await wechatMpQueryPublishStatus({\n  publish_id: publishResult.data.publish_id\n});\n```\n\n## Project Structure\n\n```\nwechat-mp-publisher/\n├── SKILL.md                    # This file\n├── README.md                   # Project documentation\n├── package.json                # Dependencies\n├── tsconfig.json               # TypeScript config\n├── src/\n│   ├── index.ts               # Main entry & OpenClaw tools\n│   ├── auth.ts                # AccessToken management\n│   ├── media.ts               # Media upload\n│   ├── article.ts             # Article management\n│   └── types.ts               # TypeScript types\n├── scripts/                    # CLI scripts (optional)\n└── tests/                      # Test files\n```\n\n## Error Handling\n\nAll tools return a standardized response:\n\n```typescript\n{\n  success: boolean;    // Operation success status\n  message: string;     // Human-readable message\n  data?: any;          // Response data on success\n}\n```\n\nOn failure, `success` will be `false` and `message` contains the error description.\n\n## API Reference\n\nBased on WeChat Official Account API:\n- https://developers.weixin.qq.com/doc/offiaccount/en/Getting_Started/Overview.html\n\n## License\n\nMIT\n","topics":["WeChat","微信"],"tags":{"latest":"0.1.0","mp":"0.1.0","publish":"0.1.0","wechat":"0.1.0"},"stats":{"comments":0,"downloads":665,"installsAllTime":25,"installsCurrent":0,"stars":0,"versions":1},"createdAt":1773281801846,"updatedAt":1778491843876},"latestVersion":{"version":"0.1.0","createdAt":1773281801846,"changelog":"WeChat Official Account article publishing skill, initial release:\n\n- New tools to upload media, manage drafts, and publish articles using the WeChat MP API.\n- Automatic handling of AccessToken, media uploads, and article publishing workflows.\n- Supports immediate publishing or draft saving, querying publish status, and deleting drafts.\n- Easy configuration via file or environment variables.\n- Includes full documentation, usage examples, and standardized error handling.","license":"MIT-0"},"metadata":null,"owner":{"handle":"ryan32382","userId":"s17d395k7y7z58fbj6jdyq400s884mpc","displayName":"ryan32382","image":"https://avatars.githubusercontent.com/u/212868755?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089845213}}