使用微信公众号发送图文消息
http请求方式:POST
http请求url:https://api./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./cgi-bin/message/custom/send?access_token="+ token;//图文回复String title = "感谢关注!";//标题String Description = "高效安全,方便快捷。";//描述String Url = "https://mp./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);}
如果觉得《微信公众平台 关注发送客服图文消息 错误 errcode:40003及解决》对你有帮助,请点赞、收藏,并留下你的观点哦!