From b00e86fb8fc24c2ebcbf7e37717445340d98173c Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Sun, 17 Aug 2025 09:01:57 +0000 Subject: [PATCH] fix: improve webhook notifications for all providers - Show full list of grouped alerts for Discord, Slack, Teams, etc (not just Telegram) - Properly escape newlines in grouped alert messages to prevent JSON parsing errors - Ensure consistent formatting across all webhook providers - Address issue where only custom templates showed complete alert lists All webhook providers now display the same detailed grouped alert format with bullet points showing each alert's resource and value. --- internal/notifications/notifications.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/notifications/notifications.go b/internal/notifications/notifications.go index 770f9fea4..ee7c7486c 100644 --- a/internal/notifications/notifications.go +++ b/internal/notifications/notifications.go @@ -493,9 +493,16 @@ func (n *NotificationManager) sendGroupedWebhook(webhook WebhookConfig, alertLis } if templateFound { - // Modify message if multiple alerts + // Modify message if multiple alerts - show full list with escaped newlines if len(alertList) > 1 { - alert.Message = fmt.Sprintf("%s (and %d more alerts)", alert.Message, len(alertList)-1) + summary := alert.Message + otherAlerts := []string{} + for i := 1; i < len(alertList); i++ { + otherAlerts = append(otherAlerts, fmt.Sprintf("• %s: %.1f%%", alertList[i].ResourceName, alertList[i].Value)) + } + if len(otherAlerts) > 0 { + alert.Message = fmt.Sprintf("%s\\n\\nšŸ”” All %d alerts:\\n%s", summary, len(alertList), strings.Join(otherAlerts, "\\n")) + } } // Prepare data and generate payload