Webhook added for kubewatch notifcation
This commit is contained in:
parent
547506036e
commit
1ab21b76dc
2 changed files with 2 additions and 4 deletions
BIN
api-server
BIN
api-server
Binary file not shown.
6
main.go
6
main.go
|
@ -110,13 +110,11 @@ func notifyHandler(c *gin.Context) {
|
||||||
botToken := os.Getenv("BOT_TOKEN")
|
botToken := os.Getenv("BOT_TOKEN")
|
||||||
chatid := os.Getenv("CHAT_ID")
|
chatid := os.Getenv("CHAT_ID")
|
||||||
|
|
||||||
telegramToken := botToken
|
|
||||||
chatID := chatid
|
|
||||||
message := fmt.Sprintf("Service '%s' was updated to image '%s'", data.Name, data.Image)
|
message := fmt.Sprintf("Service '%s' was updated to image '%s'", data.Name, data.Image)
|
||||||
|
|
||||||
telegramAPI := fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage", telegramToken)
|
telegramAPI := fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage", botToken)
|
||||||
resp, err := http.PostForm(telegramAPI, url.Values{
|
resp, err := http.PostForm(telegramAPI, url.Values{
|
||||||
"chat_id": {chatID},
|
"chat_id": {chatid},
|
||||||
"text": {message},
|
"text": {message},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue