POST/v1/creative/wechat-mp/articles
Beta2026-04-01Try it

PublishService.PublishToWechatMp

发布到微信公众号

直接把 Markdown 或 HTML 内容发布到微信公众号——一站式完成正文预处理、封面上传、创建或更新草稿,并可选触发群发;适合 CLI 工具直接调用的场景。

Authentication

支持组合OAuth 2.0API Key
No identity
User identity
Org identity
所需 scopes:creative:writecreative:publish

Request body · PublishToWechatMpRequest

字段类型必填描述
titlestring—文章标题(必填)。
authorstring—文章作者。
digeststring—文章摘要,未填写时微信默认截取正文前 120 字。
contentstring—Markdown 或 HTML 正文内容(必填)。
image_mapobject—正文中的图片映射:本地路径/标识 → 已上传的微信图片 URL。
cover_urlstring—封面图 URL,将自动上传为微信 thumb 素材。
targetPublishToWechatMpTarget—发布目标:草稿或群发。
template_idstring—排版模板/主题 ID。
content_source_urlstring—原文链接 URL。
show_cover_picboolean—是否在正文中显示封面图。
need_open_commentboolean—是否开启评论功能。
debugboolean—是否返回调试日志。
cached_articlesarray<PublishedArticleInfo>—客户端缓存的已发布文章(往期推荐功能的回退数据源)。
wechat_mp_credentialsWechatMpCredentials—微信公众号 API 调用凭证(必填)。 详见 WechatMpCredentials 设计说明(types.proto)。
content_formatContentFormat—正文格式。未指定时按 Markdown 处理,以兼容旧客户端。

Response

200 OK · PublishToWechatMpResponse

字段类型必填描述
okboolean—操作是否成功。
messagestring—结果描述信息。
media_idstring—草稿的 media_id。
debug_logsarray<string>—调试日志(debug=true 时返回)。
published_articlesarray<PublishedArticleInfo>—拉取到的已发布文章列表(供客户端缓存)。

错误响应 · google.rpc.Status

非 2xx 响应均按 AIP-193 规范包装为google.rpc.Status,含 code /message /details 三段。details[].reason 是机器可读的具体错误原因码,可用于客户端分支处理。

字段类型必填描述
codeinteger (int32)—The status code, which should be an enum value of google.rpc.Code.
messagestring—A developer-facing error message.
detailsarray<Any>—A list of messages that carry the error details.

Examples

curl -X POST \
  'https://api.appforges.com/v1/creative/wechat-mp/articles' \
  -H 'Authorization: Bearer $ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "title": "string",
    "author": "string",
    "digest": "string",
    "content": "string",
    "image_map": {},
    "cover_url": "string",
    "target": "PUBLISH_TO_WECHAT_MP_TARGET_UNSPECIFIED",
    "template_id": "string",
    "content_source_url": "string",
    "show_cover_pic": false,
    "need_open_comment": false,
    "debug": false,
    "cached_articles": [
      {
        "title": "string",
        "url": "string",
        "publish_time": 0,
        "category": "string"
      }
    ],
    "wechat_mp_credentials": {
      "app_id": "string",
      "app_secret": "string"
    },
    "content_format": "CONTENT_FORMAT_UNSPECIFIED"
  }'
OpenAPI spec v0.59.4 · synced 10/11/2026, 11:27:14 PM