微信公众平台 关注发送客服图文消息 错误 errcode:40003及解决

使用微信公众号发送图文消息
http请求方式: POST
http请求url:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
所需json数据包:

{
    "touser":"OPENID",
    "msgtype":"news",
    "news":{
        "articles": [
         {
             "title":"Happy Day",
             "description":"Is Really A Happy Day",
             "url":"URL",
             "picurl":"PIC_URL"
         }
         ]
    }
}

遇到问题:
返回错误 invalid openID错误 errcode:40003,同样的数据包在接口调试工具里可以发送。
解决办法:
picurl 在文档中的参数要求是
参数说明
picurl 为必须参数并且图片格式须按要求

关注公众号,发送图文消息代码 java;

//关注公众号 自动发送
				if (EventKey.equals("<![CDATA[subscribe]]>")) {
					
					String urlStr = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token="+ token;	
//					图文回复
					String title = "感谢关注!";//标题
					String Description = "高效安全,方便快捷。";//描述
					String Url = "https://mp.weixin.qq.com/s?__biz=****==&mid=**********&idx=1&sn=*********";//点击图文消息跳转链接
					String PicUrl = "http://*********/img/1.jpg";//图片地址
					//拼接json包
					String jsonstr = "{\"touser\":\""
						+ FromUserName
						+ "\",\"msgtype\":\"news\",\"news\":{\"articles\":[{\"title\":\""+ title + "\",\"description\":\""+ Description
								+  "\",\"url\":\""+ Url+  "\",\"picurl\":\""+ PicUrl+"\"}]}";
					//发送post请求
					httpDownloader.uploadjson(urlStr, jsonstr);
					}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值