Skip to content
/ ding Public

一款非常简单的钉钉群机器人发送通知的 Go 模块

License

Notifications You must be signed in to change notification settings

xthz/ding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ding

一款非常简单的钉钉群机器人发送通知的Go模块


安装

go get -u github.com/wanghuiyt/ding

钉钉群机器人设置为 "加签" 验证 (如何开启钉钉群机器人)



例子

普通消息

import "github.com/wanghuiyt/ding"

d := ding.Webhook{
    AccessToken: "8c03f234ddf2axxxxxxxxxxxx",
    Secret:      "SECefded9b38b761fxxxxxxxx",
}
err := d.SendMessage("这是普通的群消息")
...

Done!



使用

import "github.com/wanghuiyt/ding"

普通消息
d := ding.Webhook{
    AccessToken: "8c03f234ddf2axxxxxxxxxxxx",
    Secret:      "SECefded9b38b761fxxxxxxxx",
}
err := d.SendMessage("这是普通的群消息")

@特定人的消息
d := ding.Webhook{
    AccessToken: "8c03f234ddf2axxxxxxxxxxxx",
    Secret:      "SECefded9b38b761fxxxxxxxx",
    EnableAt:    true,
}
err := d.SendMessage("Harvey, 你的程序挂了", "1856362xxxx")
...
err = d.SendMessage("Harvey, Bob 和 Bella, 你们的程序挂了", "1856362xxxx", "1867800xxxx", "1715372xxxx")

img-at


@所有人的消息

必须同时开启 EnableAtAtAll

d := ding.Webhook{
    AccessToken: "8c03f234ddf2axxxxxxxxxxxx",
    Secret:      "SECefded9b38b761fxxxxxxxx",
    EnableAt:    true, // 开启艾特
    AtAll:       true, // 艾特所有人
}
err := d.SendMessage("这是@所有人的消息")

i

About

一款非常简单的钉钉群机器人发送通知的 Go 模块

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages