Skip to content

Commit

Permalink
新增 客服消息,发送图文消息(点击跳转到图文消息页面)接口 (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
finian authored and JacksonTian committed Jun 11, 2018
1 parent 7637ae9 commit 7f54556
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/api_message.js
Expand Up @@ -254,6 +254,30 @@ exports.sendNews = async function (openid, articles) {
return this.request(url, postJSON(data));
};

/**
* 客服消息,发送图文消息(点击跳转到图文消息页面)
* 详细细节 https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140547
* Examples:
* ```
* api.sendMpNews('openid', 'mediaId');
* ```
* @param {String} openid 用户的openid
* @param {String} mediaId 图文消息媒体文件的ID
*/
exports.sendMpNews = async function (openid, mediaId) {
const { accessToken } = await this.ensureAccessToken();
var url = this.prefix + 'message/custom/send?access_token=' + accessToken;
var data = {
'touser': openid,
'msgtype':'mpnews',
'mpnews': {
'media_id': mediaId
}
};
return this.request(url, postJSON(data));
};

/**
* 获取自动回复规则
* 详细请看:<http://mp.weixin.qq.com/wiki/19/ce8afc8ae7470a0d7205322f46a02647.html>
Expand Down

0 comments on commit 7f54556

Please sign in to comment.