From 50325ab9d5f64fa018d8b2eb533ff167df67449e Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 16 Nov 2026 16:47:17 -0500 Subject: [PATCH] fix(backend): add transactional_email_blocked to email.suppressed reasons The `email.suppressed` webhook event types the reason of a `ClerkPolicy` suppression as a closed union of three values. The Backend API now also sends `transactional_email_blocked`, when a queued transactional email is suppressed because sending was blocked for the instance, so the union was missing a value the API returns. Co-Authored-By: Claude Fable 5.2 --- .changeset/calm-emails-block.md | 5 +++++ packages/backend/src/__tests__/email-outcomes.test.ts | 5 ++++- packages/backend/src/api/resources/Webhooks.ts | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/calm-emails-block.md diff --git a/.changeset/calm-emails-block.md b/.changeset/calm-emails-block.md new file mode 100644 index 00000000000..ca04c300599 --- /dev/null +++ b/.changeset/calm-emails-block.md @@ -0,0 +1,5 @@ +--- +'@clerk/backend': patch +--- + +Add `transactional_email_blocked` to the `ClerkPolicy` reasons of the `email.suppressed` webhook event type. Clerk sends this reason when a queued transactional email is suppressed because sending was blocked for the instance. diff --git a/packages/backend/src/__tests__/email-outcomes.test.ts b/packages/backend/src/__tests__/email-outcomes.test.ts index 29f0ae98f8b..5411e8701b9 100644 --- a/packages/backend/src/__tests__/email-outcomes.test.ts +++ b/packages/backend/src/__tests__/email-outcomes.test.ts @@ -28,7 +28,10 @@ describe('transactional email outcome webhooks', () => { type Suppressed = Extract; type Policy = Extract; expectTypeOf().toEqualTypeOf< - 'unverified_email_dns' | 'provider_domain_restriction' | 'application_communication_lock' + | 'unverified_email_dns' + | 'provider_domain_restriction' + | 'application_communication_lock' + | 'transactional_email_blocked' >(); type Failed = Extract; expectTypeOf().toEqualTypeOf< diff --git a/packages/backend/src/api/resources/Webhooks.ts b/packages/backend/src/api/resources/Webhooks.ts index a8974b847a9..7b3bb11edc8 100644 --- a/packages/backend/src/api/resources/Webhooks.ts +++ b/packages/backend/src/api/resources/Webhooks.ts @@ -76,7 +76,11 @@ export type EmailDeliveryWebhookEvent = | { type: 'OnProviderSuppressionList'; message: string } | { type: 'ClerkPolicy'; - reason: 'unverified_email_dns' | 'provider_domain_restriction' | 'application_communication_lock'; + reason: + | 'unverified_email_dns' + | 'provider_domain_restriction' + | 'application_communication_lock' + | 'transactional_email_blocked'; message: string; }; }