diff --git a/src/lib/operationalWebhook/channelAdapters.ts b/src/lib/operationalWebhook/channelAdapters.ts index ef2533c..e2880ee 100644 --- a/src/lib/operationalWebhook/channelAdapters.ts +++ b/src/lib/operationalWebhook/channelAdapters.ts @@ -25,9 +25,9 @@ export function operationalWebhookEventTitle(eventType: string): string { /** Infer Slack / Teams formatting from webhook URL host. */ export function detectNotificationChannel(targetUrl: string): NotificationChannel { try { - const hostname = new URL(targetUrl).hostname.toLowerCase(); - const matchesDomain = (domain: string) => - hostname === domain || hostname.endsWith(`.${domain}`); + const host = new URL(targetUrl).hostname.toLowerCase().replace(/\.$/, ""); + const matchesDomain = (domain: string): boolean => + host === domain || host.endsWith(`.${domain}`); if (matchesDomain("hooks.slack.com") || matchesDomain("slack.com")) return "slack"; if (