Skip to content
/ ding Public
forked from xthz/ding

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

License

Notifications You must be signed in to change notification settings

762610973/ding

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ding

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

安装

go get github.com/wanghuiyt/[email protected]

获取机器人参数

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

获取 AccessToken 和 Secret 参数, AccessToken 在加签机器人的 Webhook 地址里, 比如获取到的 Webhook 地址为 https://oapi.dingtalk.com/robot/send?access_token=8c03f234ddf2axxxxxxxxxxxx, 那么 AccessToken 应该填写 8c03f234ddf2axxxxxxxxxxxx

img-at

例子

普通群消息

import "github.com/wanghuiyt/ding"

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

Done !


使用

import "github.com/wanghuiyt/ding"

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

img-at


@特定人的消息

@对象必须为绑定钉钉的手机号

...
err := d.SendMessageText("Lucy, Harvey, 你们的程序挂了", "18578924567", "+13414567890")

img-at


@所有人的消息
...
err := d.SendMessageText("这是@所有人的消息", "*")
...

i

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%