Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use nailing Robot to push messages in Go language

Shulou Source: shulou.com Published: 2022-06-03 10:45:36 09月13日 Update

Editor to share with you how to use the nailing robot to push messages in Go language. I hope you will get something after reading this article. Let's discuss it together.

Create a nailing robot

This is relatively simple.

After adding it, I will give you a webhook, which is the address where we sent the message.

Push message

Show code!

Func SendDingMsg (msg string) {/ / request address template webHook: = `https://oapi.dingtalk.com/robot/send?access_token=04c381fc31944ad2905f31733e31fa15570ae12efc857062dab16b605a369e4c` content: =` {"msgtype": "text", "text": {"content": "`+ msg +`"}} `/ / create a request req, err: = http.NewRequest ("POST", webHook) Strings.NewReader (content) if err! = nil {/ / handle error} client: = & http.Client {} / / set request header req.Header.Set ("Content-Type", "application/json" Charset=utf-8 ") / / send request resp, err: = client.Do (req) / / close request defer resp.Body.Close () if err! = nil {/ / handle error}}

Sent successfully!

After reading this article, I believe you have some understanding of "how to use nailing robot to push messages in Go language". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Tags: Messages machines robots push language address articles success done that is more templates knowledge industry information information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Tech Info Xiaomi Shulou Information Linux