fix: webhook custom templates not being used when service field is empty

- Fixed bug where custom webhook templates were being overwritten with generic payload
- The issue occurred when a webhook had a custom template but empty service field
- Now properly preserves custom template payloads regardless of service field value
- Telegram webhooks and other custom template webhooks now work correctly
- Addresses user reports of webhook delivery issues
This commit is contained in:
Pulse Monitor
2025-08-16 21:57:27 +00:00
parent 053e4da097
commit 97e317148c
+2 -1
View File
@@ -770,7 +770,8 @@ func (n *NotificationManager) sendWebhook(webhook WebhookConfig, alert *alerts.A
}
// Use generic payload if no service or template not found
if webhook.Service == "" || webhook.Service == "generic" || jsonData == nil {
// But ONLY if jsonData hasn't been set yet (from custom template)
if jsonData == nil && (webhook.Service == "" || webhook.Service == "generic") {
// Use generic payload for other services
payload := map[string]interface{}{
"alert": alert,