UNPKG

@neuit/wemp

Version:

用于管理微信服务号的Node.js接口库

48 lines (39 loc) 1.92 kB
const { Base, Web, SubscriptionMessage } = require('../lib/main') // 初始化对象 const base = new Base(); async function testBase() { // 获取access_token const access_token = await base.getAccessToken(); console.log(access_token); } // testBase(); // https://mp.weixin.qq.com/mp/subscribemsg?action=get_confirm&appid=wx8e27fb5064dd6f68&scene=1000&template_id=62cs4lB9WkPGQpazj6zLCMS1sy_EmRU1uUzE5oBm1gw&redirect_url=http%3A%2F%2Fhealth.nimihealth.cn%2Fmobile-test%2Fmp%3Fagentid%3D368ab44e-c824-4c8f-990d-12f280518dfb&reserved=test#wechat_redirect // https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e27fb5064dd6f68&redirect_uri=http%3A%2F%2Fhealth.nimihealth.cn%2Fmobile-test%2Fmp%3Fagentid%3D368ab44e-c824-4c8f-990d-12f280518dfb&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect // https://mp.weixin.qq.com/mp/subscribemsg?action=get_confirm&appid=wx8e27fb5064dd6f68&scene=1000&template_id=BqlkcncP7aJJZ5hzEX9zcEZKSzIiwYH9HhadsVJfIkY&redirect_url=http%3A%2F%2Fhealth.nimihealth.cn%2Fmobile-test%2Fmp%3Fagentid%3D368ab44e-c824-4c8f-990d-12f280518dfb#wechat_redirect async function testWeb() { // const web = new Web(); // // const res = await web.getWebAccessToken('081JXOFa1x8ToJ0CYkGa1wLJvx1JXOFP'); // // console.log(res); // const res = await web.getUserInfo('oBP7_6jU45PW2Up6Gu0mx9yKp4ro'); // console.log(res); // const res = await base.getJssdkConfig('https://www.baidu.com'); // console.log(res); const message = new SubscriptionMessage(); const res = await message.sendTemplate('oBP7_6jU45PW2Up6Gu0mx9yKp4ro', 'SMcJu2StjN-W0iaGJ1FeD1mVDhmB3CzO-qfT9n8OMdI', { character_string9: { value: 'sdfasfasdf214312431242' }, thing18: { value: '测试' }, time10: { value: '2025-01-01' } }); console.log(res); } testWeb();