mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-23 03:33:53 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user