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

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

相关推荐
星云API技术支持。8 小时前
企业微信二次开发机器人:如何实现消息分类、转发与业务分发
机器人·企业微信
天空属于哈夫克38 小时前
企业微信私域SOP消息节点设置
企业微信
星云API技术支持。10 小时前
企业微信二次开发机器人:如何根据不同群聊配置独立处理逻辑
机器人·企业微信
梦想的旅途23 天前
如何高效调用企业微信通讯录API管理组织架构
java·开发语言·企业微信
梦想的旅途24 天前
企业微信API如何实现自动化办公
运维·自动化·企业微信
天空属于哈夫克34 天前
企业微信API实现企业内部消息精准推送的最佳实践
企业微信
星云API技术支持4 天前
企业微信二次开发:外部群机器人如何把群消息接入工单系统?
机器人·企业微信
星云API技术支持。4 天前
企业微信二次开发:外部群机器人,从群消息到业务系统如何打通?
机器人·企业微信
梦想的旅途24 天前
企业微信API在考勤与审批流程自动化中的应用
运维·自动化·企业微信
梦想的旅途24 天前
企业微信API接口调用频率限制与性能优化技巧
企业微信