java 微信发送客服消息
2015-04-03 11:09
375 查看
public static boolean sendCustomMessage(String accessToken, String jsonMsg){ logger.info("消息内容:{"+jsonMsg+"}"); boolean result = false; //请求地址 String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN"; requestUrl = requestUrl.replace("ACCESS_TOKEN", accessToken); //发送客服消息 JSONObject jsonObject = WeixinUtil.httpRequest(requestUrl, "POST", jsonMsg); if(null != jsonObject){ int errorCode = jsonObject.getInt("errcode"); String errorMsg = jsonObject.getString("errmsg"); if(0 == errorCode){ result = true; logger.info("客服消息发送成功errorCode:{"+errorCode+"},errmsg:{"+errorMsg+"}"); System.out.println("客服消息发送成功errorCode:{"+errorCode+"},errmsg:{"+errorMsg+"}"); }else{ logger.info("客服消息发送失败errorCode:{"+errorCode+"},errmsg:{"+errorMsg+"}"); System.out.println("客服消息发送失败errorCode:{"+errorCode+"},errmsg:{"+errorMsg+"}"); if(errorCode == 40001 || errorCode == 42001 ){ System.out.println("12321"); new Thread(new TokenThreadNew()).start(); } } } return result; }
相关文章推荐
- java 发送微信客服消息
- 微信开发处理超时5s(java),异步发送客服消息
- java 微信发送客服消息
- java微信开发(wechat4j)——发送客服消息
- java获得微信的AccessToken并主动发送客服消息
- 微信客服给单个用户发送消息
- Java微信二次开发之12-表情发送的实现-与文本消息的对接
- JAVA微信开发:[20]如何实现主动发送微信消息
- JAVA模拟微信消息发送请求
- 微信公众账号开发,将消息转发到指定客服java 代码
- 微信开发-发送客服消息
- Java微信二次开发(二) Java微信文本消息接口请求与发送
- 微信发送客服消息
- java实现微信图文消息的发送
- java调用微信客服消息(发货通知)
- java微信 客服接口-发消息 中文乱码
- Java与微信不得不说的故事——消息的接收与发送
- php发送微信客服消息
- java微信开发发送消息
- java微信 客服接口-发消息 中文乱码