node消息通知:微信公众号推送

354 阅读1分钟

推送平台:pushplus

使用方法:关注公众号后获取token

node代码:

const got = require('got')

const PUSH_URL = 'http://www.pushplus.plus/send' // pushplus 推送api


// push
async function handlePush (desp) {
  const body = {
    token: `${PUSH_PLUS_TOKEN}`,
    title: `推送测试
    content: `${desp}`
  };
  const res = await got.post(PUSH_URL, {
    json: body
  })
  console.log(res.body)
}
handlePush('推送消息:XXXX')