-
Notifications
You must be signed in to change notification settings - Fork 77
Dinger 2.0 快速使用Dinger
Jaemon edited this page Dec 26, 2020
·
1 revision
<dependency>
<groupId>com.github.answerail</groupId>
<artifactId>dinger-spring-boot-starter</artifactId>
<version>${dinger.version}</version>
</dependency>
spring:
dinger:
project-id: ${spring.application.name}
dingers:
# 使用钉钉机器人, 请根据自己机器人配置信息进行修改
dingtalk:
tokenId: 87dbeb7bc28894c3ycyl3d12457228ad309966275b5f427cd85f9025ebb520cf
secret: AEQ74a9039ai01f2ljm017b90ycye9asg6335f97c658ff37ff371ec8120581c7f09
spring:
dinger:
project-id: ${spring.application.name}
dingers:
# 使用企业微信机器人, 请根据自己机器人配置信息进行修改
wetalk:
token-id: 32865206-7082-46l5-8j39-2m7ycy6d868
@Component
public class AppInit implements InitializingBean {
@Autowired
private DingerSender dingerSender;
@Override
public void afterPropertiesSet() throws Exception {
// 发送text类型消息
dingerSender.send(
MessageSubType.TEXT,
DingerRequest.request("Hello World, Hello Dinger")
);
// 发送markdown类型消息
dingerSender.send(
MessageSubType.MARKDOWN,
DingerRequest.request("Hello World, Hello Dinger", "启动通知")
);
}
}