我用公众号关联的小程序的AppId和Secret得到AccessToken, 然后用官方的调试工具调用客服接口推送消息给小程序,请求和应答如下:
请求:
{
"touser": "okF875JiGs--9oGrGzito1oLwVNM",
"msgtype": "miniprogrampage",
"miniprogrampage": {
"title": "test title",
"appid": "wx967a4ea1c5946778",
"pagepath": "/app/pagepath",
"thumb_media_id": "Fyx4qcCsZs0Iu2JRTIVqw4RYc2b1DuW352Z0lqJUAo"
}
}
应答:
Connection: keep-alive
Date: Sun, 04 Aug 2019 03:42:17 GMT
Content-Type: application/json; encoding=utf-8
Content-Length: 106
{ "errcode": 45015, "errmsg": "response out of time limit or subscription is canceled hint: [eqOqBA01374924]"
}
提示: Customer service response over the limit
妈的原来是图片的问题,图片传小了,另外AccessToken使用公众号的就可以,touser也是公众要对应的openid即可。