收藏
回答

微信小程序发送模板消息,invalid openid hint?


data = {
            touser: 'oPJMs5D26gFhcIh7fi6BdUIFZ4jM',
            template_id,
            page:'userAm',
            form_id: formId,
            data:{
              keyword1:{
                  value:name
              },
              keyword2:{
                  value:phone
              },
              keyword3:{
                  value:time
              }
            }
        }

网上看问题是openid不属于这个小程序,但是上面的touser是我在开发者工具的云开发里找的openid,还是显示invalid openid hint



await axios.post(`https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=${access_token}`,{
            data:JSON.stringify(data)
        }).then((res)=>{
            if(res.status === 200 && !res.data.errcode){
                // console.log(res.data);
                 
                resolve({
                    code: 0
                })
            }else{
                console.log(res.data);
                reject ({
                    code: -1,
                    msg: '发送失败',
                    data:res.data
                })
            }
        }).catch((err)=>{
            reject ({
                code: -1,
                msg: '获取失败',
                err
            })
             
        })


最后一次编辑于  2019-08-30
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签