Use the WeChat work API in your Golang apps to send notifications
API reference for WeChat Work, please check this to know how to configure the settings below.
go get github.com/clem109/go-wechat-work
In the below example we include TextCard, Text and News however only the News will be sent as the MsgType is set to "news".
package main
import ("github.com/clem109/go-wechat-work")
func main() {
wechat := WeChatWork{
Config: Config{
CorpID: "corpid",
CorpSecret: "somesecret",
SkipVerify: true,
Debug: false,
Notification: Notification{
Agentid: 123456,
MsgType: "news",
ToUser: "@all",
ToParty: "@all",
ToTag: "@all",
Safe: 0,
TextCard: TextCard{
Title: "test",
Description: "testing",
MsgURL: "someurl;",
BtnTxt: "p",
},
Text: Text{
Content: "text message test",
},
News: News{
Articles: []Article{
Article{
Title: "Testing News",
Description: "Star my repo ;)",
URL: "https://github.com/clem109/go-wechat-work",
PicURL: "https://raw.githubusercontent.com/clem109/glowing-gopher/master/gopher.jpeg",
},
},
},
},
},
}
wechat.Exec()
}