Skip to content
forked from xthz/ding

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

License

Notifications You must be signed in to change notification settings

inAnyWorld/ding

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 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

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%