(accessToken, mediaId)
| 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 { |