一次性订阅消息无法显示内容
按照文档向用户发送一次性订阅消息,代码片段如下
String accessToken = getAccessToken();String uri = "https://api.weixin.qq.com/cgi-bin/message/template/subscribe?access_token=" + accessToken; BasicDBObject content = new BasicDBObject(); content.append("value", "test test \n test test"); content.append("color", "#1B5E20"); BasicDBObject testData = new BasicDBObject(); testData.append("content", content); BasicDBObject postData = new BasicDBObject(); postData.append("touser", toUser) .append("template_id", template_id) .append("url", url) .append("scene", scene) .append("title", title) .append("data", testData); logger.info(postData.toJson()); String resp = postRequestJson(uri, postData.toJson()); |
系统log如下:
21-Sep-2018 19:17:29.955 INFO [http-nio-443-exec-48] helper.WeixinAppHelper.subscribeMsg { "touser" : "oKn3lvkut8w-H0oM2c-3Rhsqx70o", "template_id" : "k5dLFam6GtlfptCMkbR02eqIeO22oNqn8SaL1bSSuc4", "url" : "https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzUxNDAzMzQ0MA==&scene=1", "scene" : "1", "title" : "?????????????", "data" : { "content" : { "value" : "test test \n test test", "color" : "#1B5E20" } } } |
结果在微信里显示的一次性订阅消息并未出现消息内容, 哪里出问题了?谢谢
