- 如何解决"发送订阅消息" 报错 "argument invalid! data.characte"?
# 请求参数: { "data": "{\"character_string1\":{\"value\":\"BATTERY-100000001\"},\"character_string2\":{\"value\":\"19%\"},\"character_string6\":{\"value\":\"1231100121\"},\"thing3\":{\"value\":\"当前电量较低,请及时充电\"},\"time4\":{\"value\":\"2023-05-08 11:09:30\"}}", "lang": "zh_CN", "miniprogram_state": "developer", "template_id": "xxxxxx", "touser": "xxxxx" } # 响应结果 { "errcode": 47003, "errmsg": "argument invalid! data.character_string1.value i rid: 67d92a6b-2040fd7e-06fb5956", } 调用失败截图: [图片]
03-18 - 如何解决"发送订阅消息" 报错 "user refuse to accept the msg"?
/** * 发送订阅消息的方法 * 官方文档:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/mp-message-management/subscribe-message/sendMessage.html * * @return 返回微信服务器响应结果 */ public String sendSubscribeMessage(MessageBody data,Long deptId) { ChgWxConfig chgWxConfig = wxConfigService.selectChgWxConfigById(deptId); // 测试获取accessToken String accessToken = getAccessToken(chgWxConfig.getSubAppid(), chgWxConfig.getSecretKey()); JSONObject jsonObject = JSONObject.parseObject(accessToken); String token = jsonObject.get("access_token").toString(); // 构建请求URL String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + token; // 将消息体转换为JSON字符串 String jsonPayload = JSONObject.toJSONString(data); try { // 发送POST请求并返回结果 return HttpUtil.post(url, jsonPayload); } catch (Exception e) { log.error("发送订阅消息出错:{}", e.getMessage()); return null; } [图片] 服务器回包是成功: [图片] [图片]
03-18