How to send nailing Robot message by Golang
This article introduces the relevant knowledge of "how to send nailing robot messages by Golang". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
To create a nailing robot, you must use the endorsement method.
1. Install the ding module package
Go get-u github.com/wanghuiyt/ding
two。 Ordinary group messages are used
Use your own generated AccessToken and Secret
D: = ding.Webhook {AccessToken: "8c03f...", Secret: "SECef..."}
_ = d.SendMessage ("this is a normal group message")
Effect:
Detailed tutorial
Create a nailing robot (you must use endorsement)
Get access_token and Secret:
Access_token is a parameter in the url of Webhook.
Secret is the value of the endorsement.
Using Golang docking
We use the https://www.cnblogs.com/wanghuiyt/p/github.com/wanghuiyt/ding package.
Installation:
Go get-u github.com/wanghuiyt/ding
Use:
Package mainimport "github.com/wanghuiyt/ding" func main () {d: = ding.Webhook {AccessToken: "8c03f234ddf2a7555.", / / the access_token Secret obtained above: "SECefded9b38b761f." / / the value of the endorsement obtained above} _ = d.SendMessage ("this is an ordinary group message")} "how to send nailing robot messages by Golang" is introduced here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!