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

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

相关推荐
梦想的旅途23 小时前
企业微信 API 二次开发:私域场景下的自动化裂变
运维·自动化·企业微信
梦想的旅途221 小时前
企业微信API:企业微信接口能实现哪些功能?
企业微信
梦想的旅途21 天前
企微 API 二次开发:结合 AI 打造考勤打卡与报表智能分析系统
人工智能·企业微信
鱼日先生2 天前
办公聊天软件接入 Hermes Agent 实录(一):企业微信 WebSocket 长连接 + Dify 知识库问答
企业微信·dify·ai agent·大模型应用·hermes agent
梦想的旅途22 天前
企微私域自动化:客户全生命周期 SOP 策略与配置实战
运维·自动化·企业微信
梦想的旅途22 天前
企业微信销售自动化:线索分配与超时预警
小程序·自动化·企业微信
梦想的旅途22 天前
企微社群裂变实战:自动化群接龙与活动打卡系统搭建
运维·自动化·企业微信
梦想的旅途22 天前
企微私域 AI 创作:文案生成与 AI 配图自动化发布实战
人工智能·自动化·企业微信
梦想的旅途22 天前
企业微信API实战:Python自动化消息推送
java·前端·python·自动化·企业微信
梦想的旅途23 天前
企业微信API实战:外部群定时群发与SOP自动推送指南
企业微信