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

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、效果

相关推荐
梦想的旅途25 小时前
企业微信外部群怎么实现自动化?API接口接入思路
运维·自动化·企业微信
ITyunwei09872 天前
内存溢出报错,实战处理记录
运维·服务器·企业微信
梦想的旅途23 天前
企业微信 API 二次开发:AI 智能体与外部群业务流闭环
人工智能·microsoft·企业微信
梦想的旅途23 天前
企业微信 API 二次开发:AI 智能体接入外部群架构
人工智能·企业微信
梦想的旅途23 天前
企业微信 API 二次开发:外部群消息异步队列
企业微信
梦想的旅途23 天前
企微 API 二次开发:利用 AI Agent 实现自动化运维
运维·人工智能·企业微信
梦想的旅途23 天前
企业微信 API 二次开发:外部群智能客服落地实践
企业微信
梦想的旅途23 天前
企业微信 API 二次开发:私域场景下的自动化裂变
运维·自动化·企业微信
梦想的旅途24 天前
企业微信API:企业微信接口能实现哪些功能?
企业微信
梦想的旅途24 天前
企微 API 二次开发:结合 AI 打造考勤打卡与报表智能分析系统
人工智能·企业微信