diff --git a/internal/api/notifications.go b/internal/api/notifications.go index 5cff3894d..83c6b3e08 100644 --- a/internal/api/notifications.go +++ b/internal/api/notifications.go @@ -427,6 +427,11 @@ func (h *NotificationHandlers) TestWebhook(w http.ResponseWriter, r *http.Reques if err != nil { result["error"] = err.Error() w.WriteHeader(http.StatusBadRequest) + } else if status < 200 || status >= 300 { + // HTTP error from webhook endpoint + result["error"] = fmt.Sprintf("Webhook returned HTTP %d: %s", status, response) + result["success"] = false + w.WriteHeader(http.StatusBadRequest) } else { result["success"] = true } diff --git a/internal/notifications/notifications.go b/internal/notifications/notifications.go index f459b3c0a..4b1047533 100644 --- a/internal/notifications/notifications.go +++ b/internal/notifications/notifications.go @@ -622,13 +622,14 @@ func (n *NotificationManager) sendWebhookRequest(webhook WebhookConfig, jsonData req.Header.Set(key, value) } - // Debug log the payload for Telegram webhooks - if webhook.Service == "telegram" { + // Debug log the payload for Telegram and Gotify webhooks + if webhook.Service == "telegram" || webhook.Service == "gotify" { log.Debug(). Str("webhook", webhook.Name). + Str("service", webhook.Service). Str("url", webhookURL). Str("payload", string(jsonData)). - Msg("Sending Telegram webhook") + Msg("Sending webhook with payload") } // Send request