收藏
回答

统一服务消息无法向公众号发送消息,还是已经不能用了?

已经添加, "openapi.uniformMessage.send",环境也共享给了同主体的服务号。

报错提示:send:fail invalid weapp pagepath 

const cloud = require('wx-server-sdk')
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.uniformMessage.send({
      touser: "ojoEs5Hs_vEKJK6WerpMawL0kvZ8",
      
      "mpTemplateMsg": {
        "appid": 'wx2849e796006d1243',
        "url": 'http://weixin.qq.com/download',
        templateId: '2aoMqMgSgYsVNuQ8mF40BSrG-6rUnUV97SORb3YrK3o',
        miniprogram: {
          appid: "wx2849e796006d1243",
          pagepath: 'main/message/index'
        },
        data: {
          first: {
            value: "实验室发布了一则新的公告",
            color: "#173177"
          },
          keyword1: {
            value: '全员公告',
            color: "#173177"
          },
          keyword2: {
            value: 'sss',
            color: "#173177"
          },
          keyword3: {
            value: 'ss',
            color: "#173177"
          },
          remark: {
            value: "点击查看详细内容",
            color: "#173177"
          }
        }
      }
    })
    return result
  } catch (err) {
    return err
  }
}
回答关注问题邀请回答
收藏

1 个回答

  • 跨商通
    跨商通
    2022-08-23

    去掉pagepath试一下。


    2022-08-23
    有用
    回复
登录 后发表内容