From 0b2ab7b683b08306422e12159bcaab6cba81ba21 Mon Sep 17 00:00:00 2001 From: Kenton Duprey Date: Mon, 29 Sep 2025 19:19:16 -0400 Subject: [PATCH] feat(backend): Add `user_id` field to `organizationInvitation.accepted` webhook events. Creates a new `OrganizationInvitationAcceptedJSON` interface that extends `OrganizationInvitationJSON` with a required `user_id` field, and updates the webhook type system to use this interface specifically for `organizationInvitation`.accepted events. Signed-off-by: Kenton Duprey --- .changeset/blue-teeth-report.md | 7 +++++++ packages/backend/src/api/resources/JSON.ts | 4 ++++ packages/backend/src/api/resources/Webhooks.ts | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .changeset/blue-teeth-report.md diff --git a/.changeset/blue-teeth-report.md b/.changeset/blue-teeth-report.md new file mode 100644 index 00000000000..042669feb92 --- /dev/null +++ b/.changeset/blue-teeth-report.md @@ -0,0 +1,7 @@ +--- +'@clerk/backend': minor +--- + +Add `user_id` field to `organizationInvitation.accepted` webhook events. + +Creates a new `OrganizationInvitationAcceptedJSON` interface that extends `OrganizationInvitationJSON` with a required `user_id` field, and updates the webhook type system to use this interface specifically for `organizationInvitation`.accepted events. diff --git a/packages/backend/src/api/resources/JSON.ts b/packages/backend/src/api/resources/JSON.ts index 91ddd021239..cc67a8c347c 100644 --- a/packages/backend/src/api/resources/JSON.ts +++ b/packages/backend/src/api/resources/JSON.ts @@ -392,6 +392,10 @@ export interface OrganizationInvitationJSON extends ClerkResourceJSON { expires_at: number; } +export interface OrganizationInvitationAcceptedJSON extends OrganizationInvitationJSON { + user_id: string; +} + /** * @interface */ diff --git a/packages/backend/src/api/resources/Webhooks.ts b/packages/backend/src/api/resources/Webhooks.ts index b208748f1e3..16b4d0e1e9c 100644 --- a/packages/backend/src/api/resources/Webhooks.ts +++ b/packages/backend/src/api/resources/Webhooks.ts @@ -5,6 +5,7 @@ import type { DeletedObjectJSON, EmailJSON, OrganizationDomainJSON, + OrganizationInvitationAcceptedJSON, OrganizationInvitationJSON, OrganizationJSON, OrganizationMembershipJSON, @@ -52,10 +53,15 @@ export type OrganizationMembershipWebhookEvent = Webhook< >; export type OrganizationInvitationWebhookEvent = Webhook< - 'organizationInvitation.accepted' | 'organizationInvitation.created' | 'organizationInvitation.revoked', + 'organizationInvitation.created' | 'organizationInvitation.revoked', OrganizationInvitationJSON >; +export type OrganizationInvitationAcceptedWebhookEvent = Webhook< + 'organizationInvitation.accepted', + OrganizationInvitationAcceptedJSON +>; + export type RoleWebhookEvent = Webhook<'role.created' | 'role.updated' | 'role.deleted', RoleJSON>; export type PermissionWebhookEvent = Webhook< @@ -98,6 +104,7 @@ export type WebhookEvent = | OrganizationDomainWebhookEvent | OrganizationMembershipWebhookEvent | OrganizationInvitationWebhookEvent + | OrganizationInvitationAcceptedWebhookEvent | RoleWebhookEvent | PermissionWebhookEvent | WaitlistEntryWebhookEvent