Fetch the repository succeeded.
一款精简的发送钉钉机器人消息的工具
<dependency>
<groupId>net.1024lab</groupId>
<artifactId>smart-ding-talk</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
spring-boot :
@Configuration
public class SmartDingTalkConfig {
@Bean
public DingTalkRobotNotify createDingTalkRobotNotify() {
DingTalkRobotNotify robotNotify = DingTalkRobotNotifyBuilder.custom()
// 如果需要自定义HttpClient 可以手动指定, 否则不需要
.setHttpClient()
// 钉钉机器人 access token
.setRobotAccessToken("xxxxx")
// 设置 secret
.setSecret("xxxx")
.build();
return robotNotify;
}
}
机器人消息推送示例:
@Autowired
private DingTalkRobotNotify dingTalkRobotNotify;
public void test() {
DingTalkRobotMsgMarkdown msg = new DingTalkRobotMsgMarkdown();
msg.setTitle("test title");
msg.setText("the little yellow flower is floating in the air since the day of my birth");
dingTalkRobotNotify.sendNotify(msg);
}
目前支持的机器人消息格式:
格式 | class |
---|---|
markdown | DingTalkRobotMsgMarkdown |
text | DingTalkRobotMsgText |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。