/**
*
* sendPreview:(通过该接口发送消息给指定用户,在手机端查看消息的样式和排版。).
*
* @author HanKeQi
* @param @param openId 用户唯一标示 不能为空
* @param @param mediaId 类型
* @param @param messagetype 5中类型必选其中之一
* @param @return 设定文件
* @throws JSONObject DOM对象
* @since JDK 1.7
*/
public static JSONObject sendPreview(String openId,String mediaId,String messagetype){
String content="\"media_id\":\""+mediaId+"\"";
String send_url="https://api.weixin.qq.com/cgi-bin/message/mass/preview?access_token="+getAccessToken();
if ("text".equals(messagetype)) {
content="\"content\":\""+mediaId+"\"";
}
String jsonStr="{\"touser\":\""+openId+"\",\""+messagetype+"\":{"+content+"}, \"msgtype\":\""+messagetype+"\"}";
JSONObject jsonObject=httpRequest(send_url, "POST", jsonStr);
if (0==jsonObject.getInt("errcode")) {
return jsonObject;
}
return null;
}
微信高级群发之五预览接口
最新推荐文章于 2023-01-10 11:25:33 发布