推送飞书机器人webhookUrl消息推送
public void webhookSendTextGroupMsg(String webhookUrl, String content) {net.minidev.json.JSONObject json=new net.minidev.json.JSONObject();json.put("msg_type", "text");json.put("content","{\"text\":\"
·
1. 推送@全体人员(@某个人,all = 飞书的userId[工号])
public void webhookSendTextGroupMsg(String webhookUrl, String content) {
net.minidev.json.JSONObject json=new net.minidev.json.JSONObject();
json.put("msg_type", "text");
json.put("content", "{\"text\":\"<at user_id=\\\""+ "all" +"\\\"></at> "+content+"\"}");
String result = HttpRequest.post(webhookUrl).body(net.minidev.json.JSONObject.toJSONString(json), "application/json;charset=UTF-8").execute().body();
log.info("webhookSendGroupMsg:" + result);
}
2. 只推送内容
public void webhookSendTextGroupMsgNoUser(String webhookUrl, String content) {
net.minidev.json.JSONObject json=new net.minidev.json.JSONObject();
JSONObject text=new JSONObject();
text.put("text", content);
json.put("msg_type", "text");
json.put("content", text);
String result = HttpRequest.post(webhookUrl).body(net.minidev.json.JSONObject.toJSONString(json), "application/json;charset=UTF-8").execute().body();
}

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐
所有评论(0)