File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,30 @@ exports.sendNews = async function (openid, articles) {
254254 return this . request ( url , postJSON ( data ) ) ;
255255} ;
256256
257+ /**
258+ * 客服消息,发送图文消息(点击跳转到图文消息页面)
259+ * 详细细节 https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140547
260+ * Examples:
261+ * ```
262+ * api.sendMpNews('openid', 'mediaId');
263+ * ```
264+
265+ * @param {String } openid 用户的openid
266+ * @param {String } mediaId 图文消息媒体文件的ID
267+ */
268+ exports . sendMpNews = async function ( openid , mediaId ) {
269+ const { accessToken } = await this . ensureAccessToken ( ) ;
270+ var url = this . prefix + 'message/custom/send?access_token=' + accessToken ;
271+ var data = {
272+ 'touser' : openid ,
273+ 'msgtype' :'mpnews' ,
274+ 'mpnews' : {
275+ 'media_id' : mediaId
276+ }
277+ } ;
278+ return this . request ( url , postJSON ( data ) ) ;
279+ } ;
280+
257281 /**
258282 * 获取自动回复规则
259283 * 详细请看:<http://mp.weixin.qq.com/wiki/19/ce8afc8ae7470a0d7205322f46a02647.html>
You can’t perform that action at this time.
0 commit comments