From e3e06a8abac42405ea132d74b31b0e1539451b57 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 9 Mar 2023 18:42:21 +0100 Subject: [PATCH] Adjust template as 'GroupKey' is not what I expected it to be --- internal/webhook/handle.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/webhook/handle.go b/internal/webhook/handle.go index 3f85f78..a983f42 100644 --- a/internal/webhook/handle.go +++ b/internal/webhook/handle.go @@ -11,14 +11,13 @@ import ( const ( messageTemplate = "\U0001f6a8" + - ` **Alerts for group "_{{ .GroupKey }}_":**{{ range .Alerts }} + ` **New alerts:** @room{{ range .Alerts }} ` + "\u2022" + ` {{ if eq .Status "` + StatusResolved + `" }}` + "\u2705" + `{{ else }}{{ with .Labels.severity }}{{ if eq . "critical" }}` + "\U0001f525" + `{{ else if eq . "warning" }}` + "\U0001f4e2" + `{{ else }}` + "\U0001f514" + `{{ end }}{{ else }}` + "\U0001f514" + - `{{ end }}{{ end }} {{ .Annotations.description }}{{ end }} -@room` + `{{ end }}{{ end }} {{ .Annotations.description }}{{ end }}` ) func (s Server) handleWebhook(w http.ResponseWriter, r *http.Request) {