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

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

相关推荐
vx-bot55566614 小时前
企业微信接口在边缘计算场景下的协同处理架构
架构·企业微信·边缘计算
h7ml1 天前
于 CompletableFuture 的异步编排优化企业微信通知发送性能
android·windows·企业微信
梦想的旅途21 天前
Python 开发企微第三方 API:RPA 模式下外部群主动调用实现
架构·企业微信·rpa
老兵发新帖1 天前
Ubuntu上使用企业微信
linux·ubuntu·企业微信
梦想的旅途21 天前
RPA 架构下的企微非官方 API:外部群主动调用的技术实现与优化
架构·企业微信·rpa
h7ml1 天前
企业微信 API 与内部系统集成时的 OAuth2.0 安全上下文传递机制
java·安全·企业微信
vx-bot5556662 天前
企业微信接口在多租户SaaS平台中的集成架构与数据隔离实践
大数据·架构·企业微信
vx-bot5556662 天前
企业微信接口在混合云环境下的集成架构与网络互联方案企业微信接口在混合云环境下的集成架构与网络互联方案
网络·架构·企业微信
王者鳜錸3 天前
企业微信自动化发消息-从0到1开发实践
运维·自动化·企业微信
梦想的旅途24 天前
RPA 驱动企微非官方 API:外部群批量推送核心优化
企业微信·rpa