通过企业微信群机器人 发送群消息

1、添加群机器人,复制的webhook地址

2、

public static void main(String[] args) {

String reqUrl = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=6xdexxxxxxxxxxxxxxxxxxxxxxxxxxx";

String title = "填写日志提醒";

String dateTime = DateUtil.formatDateTime(new Date());

String content = "记得写日志哟";

String reqJson = "{\n" +

" \"markdown\": {\n" +

" \"content\": \"> " +

"告警通知:<font color=\\\"info\\\">"+title+"</font>\\n> " +

"告警时间:<font color=\\\"info\\\">"+dateTime+"</font>\\n> " +

"告警原因:<font color=\\\"warning\\\">"+content+"</font>\"\n" +

" },\n" +

" \"msgtype\": \"markdown\"\n" +

"}";

String body = cn.hutool.http.HttpRequest.post(reqUrl).body(reqJson).timeout(5000).execute().body();

System.out.println("请求结果:\n"+body);

}

3、效果

相关推荐
新辞旧梦3 天前
企业微信自建消息推送应用
服务器·python·企业微信
源雀数智5 天前
源雀SCRM开源·AI企微客服|RAG知识中枢+自训练闭环
java·人工智能·企业微信·流量运营·deepseek
只会安静敲代码的 小周8 天前
企业微信jdk 授权 记录
企业微信
某公司摸鱼前端17 天前
uniapp 仿企微左边公司切换页
前端·uni-app·企业微信
王子成_shanTou20 天前
企业微信-自建应用
企业微信
獨枭1 个月前
使用 Spring Boot 快速构建企业微信 JS-SDK 权限签名后端服务
javascript·spring boot·企业微信
nVisual1 个月前
nVisual对接企业微信实现机房设备与连接变更的自动化审批
运维·服务器·网络·自动化·企业微信·机房设备
longzl1232 个月前
企业微信实现“关联外部选项“、“审批控件中的外部选项“
java·开发语言·企业微信
网络工程师_ling2 个月前
Zabbix—企业微信报警群通消息通知
企业微信·zabbix
夜莺云原生监控2 个月前
夜莺监控 v8.0 新版通知规则 | 对接企微告警
企业微信·监控告警·夜莺监控·企微·企微告警