# dingding_Utils
**Repository Path**: godchin/dingding_Utils
## Basic Information
- **Project Name**: dingding_Utils
- **Description**: 钉钉告警机器人工具
- **Primary Language**: Unknown
- **License**: MulanPSL-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 3
- **Forks**: 0
- **Created**: 2022-02-11
- **Last Updated**: 2023-05-05
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
## 钉钉群机器人
项目封装了钉钉群机器人的发送方法,只需要输入ACCESS_TOKEN和SECRET,选择合适的发送类型,就可以一键发送。
## 使用
1. 添加pom依赖
```java
jitpack.io
https://www.jitpack.io
com.gitee.godchin
dingding_Utils
1.0.0
```
1. 获取access_token和秘钥

https://oapi.dingtalk.com/robot/send?access_token=####
获取access_token:
2. 调用DingDingService.send()方法发送消息,在参数中设置access_token和秘钥。
更多发送参数,参考:[钉钉机器人文档](https://open.dingtalk.com/document/app#/serverapi2/qf2nxq)
3. 测试
```java
@Test
void test() {
TextMsg textMsg = new TextMsg();
textMsg.setSecret(SECRET);
textMsg.setAccessToken(ACCESS_TOKEN);
textMsg.setAt(new TextMsg.At(null, null, false));
textMsg.setText(new TextMsg.Text("sdsarwhfnsduhfsbhfiadfdusfwefwe"));
DingResult send = DingDingService.send(textMsg);
System.out.println(send);
}
```
结果:


源码地址:[码云](https://gitee.com/godchin/dingding_Utils)