From f59eafb41e0d979088a7f0b71cc6bc08abe18020 Mon Sep 17 00:00:00 2001 From: Jordan Simonovski Date: Fri, 13 Nov 2026 15:43:57 +1100 Subject: [PATCH] fix(api): fill {{note}} in webhook bodies when an alert fires Closes #3644 --- .changeset/alert-note-in-webhooks.md | 6 ++++++ .../src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts | 3 +++ packages/api/src/tasks/checkAlerts/index.ts | 1 + 3 files changed, 10 insertions(+) create mode 100644 .changeset/alert-note-in-webhooks.md diff --git a/.changeset/alert-note-in-webhooks.md b/.changeset/alert-note-in-webhooks.md new file mode 100644 index 0000000000..bc57e623a3 --- /dev/null +++ b/.changeset/alert-note-in-webhooks.md @@ -0,0 +1,6 @@ +--- +'@hyperdx/api': patch +--- + +fix: `{{note}}` in webhook bodies now contains the alert's note when the alert +fires, not only in "Send test" diff --git a/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts b/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts index 8a7045229d..d3d0bbdc3b 100644 --- a/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts +++ b/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts @@ -4875,6 +4875,7 @@ describe('checkAlerts', () => { description: 'generic webhook description', body: JSON.stringify({ text: '{{link}} | {{title}}', + note: '{{note}}', }), headers: { // @ts-expect-error type mismatch due to mongoose typing @@ -4958,6 +4959,7 @@ describe('checkAlerts', () => { threshold: 1, dashboardId: dashboard.id, tileId: '17quud', + note: 'Check the api pods', }, { taskType: AlertTaskType.TILE, @@ -5027,6 +5029,7 @@ describe('checkAlerts', () => { redirect: 'manual', body: JSON.stringify({ text: `http://app:8080/dashboards/${dashboard.id}?from=1700170200000&granularity=5+minute&to=1700174700000&highlightedTileId=17quud | 🚨 Alert for "My Dashboard - Logs Count" - 3 meets or exceeds 1`, + note: 'Check the api pods', }), // Idempotency-Key is always injected last (cannot be overridden by user headers) // and is a stable objectHash of {eventId, startTime, endTime, state}. diff --git a/packages/api/src/tasks/checkAlerts/index.ts b/packages/api/src/tasks/checkAlerts/index.ts index 3ad18042f1..d34af3dd85 100644 --- a/packages/api/src/tasks/checkAlerts/index.ts +++ b/packages/api/src/tasks/checkAlerts/index.ts @@ -552,6 +552,7 @@ const fireChannelEvent = async ({ message: alert.message, name: alert.name, displayName: alert.displayName, + note: alert.note, tags: alert.tags, savedSearchId: savedSearch?.id, silenced: alert.silenced,