MCPcopy
hub / github.com/027xiguapi/code-box / publishArticle

Method publishArticle

server/WechatSender.js:54–67  ·  view source on GitHub ↗
(accessToken, mediaId)

Source from the content-addressed store, hash-verified

52 }
53
54 async publishArticle(accessToken, mediaId) {
55 const url = `https://api.weixin.qq.com/cgi-bin/freepublish/submit?access_token=${accessToken}`
56 const response = await fetch(url, {
57 method: "POST",
58 body: JSON.stringify({
59 media_id: mediaId
60 })
61 })
62 const data = await response.json()
63 if (data.errcode) {
64 throw new Error(`Failed to publish article: ${data.errmsg}`)
65 }
66 return data.publish_id
67 }
68
69 async send(event) {
70 try {

Callers 1

sendMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected