Wechat public account can automatically send text and text messages without wechat authentication.
use
npm i wechat-mp-hack --save
Copy the code
const Wechat = require('wechat-mp-hack'); Const API = new Wechat(' Wechat ', 'Wechat '); /** * @desc */ api.once (' scans.login ', (filepath) => {// Console.log (filepath); }); */ api. on('scan. Send ', (filepath) => {// Group authentication qr code address console.log(filepath); }); /** * @desc */ api.login (). Then ((data) => {/** * @desc * @param imgurls{array} remote image address */ API.batchUpload(['http://wesbos.com/wp-content/uploads/2016/09/dead-zone.png']).then((results) => { // results[0].fileid; // results[0].cdn_url; }); @param imgurl{string} Remote image address */ API.filetransfer('http://wesbos.com/wp-content/uploads/2016/09/dead-zone.png').then((result) => { console.log(result); }); /** * @desc * @param filepath{string} */ api.localupload ('qrcode-safe.png'). console.log(result); }); @param news[]. Title {string} article title * @param news[]. Thumb {string} article thumbnail * @param news[]. Description {string} Description * @param news[]. HTML {string} Article content * @param news[] API.operate_appmsg(news).then((appMsgId) => { console.log(appMsgId); }).catch(e => { console.error(e); }); @param appMsgId{string} * @param groupid{number} groupid, optional, Default -1 All users */ api.masssend (appMsgId).then(() => {console.log('success'); }).catch(e => { console.error(e); }); / * * * @ desc for public message list * @ param count {number} article message number * @ param day {number | string} today: 0 yesterday: 1: the day before yesterday earlier 2:3 5 days: 7 has been collecting news: star, the default: 0 * @return MSGS {Promise<Array<Object>>} * @return MSGS []. Content Message content * @return MSGS []. Date_time Message time * @return MSGS [].fakeId User fakeid * @return MSGS []. Func_flag * @return MSGS [].has_reply * @return MSGS [].id replyId * @return msgs[].is_vip_msg * @return msgs[].msg_status * @return msgs[].multi_item{Array} * @return msgs[].nick_name * @return MSGS [].refuse_Reason * @return MSGS [].to_uin * @return MSGS []. Type * @return MSGS [].wx_headiMG_URL User profile picture address */ API.message(1).then(msgs => { console.log(msgs); }).catch(e => console.log(e)); @param tofakeid{string} @param tofakeid; @param MSG {string} message content * @param replyId{string} reply message ID. Optional * / API. Singlesend (' osl8HwPBTCsVbquNsnYbUfOQH8sM ', 'ha ha ha ha, 425131038). Then (res = > {the console. The log (res); }).catch(e => console.log(e)); }); @param url{string} */ api.qrdecode ('qrcode-login. PNG '). Then ((result) => { console.log(result.text); });
Copy the code