Skip to content

Commit ea2bc26

Browse files
authored
feat(backend): Add user_id field to organizationInvitation.accepted webhook events (#6887)
Signed-off-by: Kenton Duprey <[email protected]>
1 parent 37028ca commit ea2bc26

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.changeset/blue-teeth-report.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@clerk/backend': minor
3+
---
4+
5+
Add `user_id` field to `organizationInvitation.accepted` webhook events.
6+
7+
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.

packages/backend/src/api/resources/JSON.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,10 @@ export interface OrganizationInvitationJSON extends ClerkResourceJSON {
392392
expires_at: number;
393393
}
394394

395+
export interface OrganizationInvitationAcceptedJSON extends OrganizationInvitationJSON {
396+
user_id: string;
397+
}
398+
395399
/**
396400
* @interface
397401
*/

packages/backend/src/api/resources/Webhooks.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
DeletedObjectJSON,
66
EmailJSON,
77
OrganizationDomainJSON,
8+
OrganizationInvitationAcceptedJSON,
89
OrganizationInvitationJSON,
910
OrganizationJSON,
1011
OrganizationMembershipJSON,
@@ -52,10 +53,15 @@ export type OrganizationMembershipWebhookEvent = Webhook<
5253
>;
5354

5455
export type OrganizationInvitationWebhookEvent = Webhook<
55-
'organizationInvitation.accepted' | 'organizationInvitation.created' | 'organizationInvitation.revoked',
56+
'organizationInvitation.created' | 'organizationInvitation.revoked',
5657
OrganizationInvitationJSON
5758
>;
5859

60+
export type OrganizationInvitationAcceptedWebhookEvent = Webhook<
61+
'organizationInvitation.accepted',
62+
OrganizationInvitationAcceptedJSON
63+
>;
64+
5965
export type RoleWebhookEvent = Webhook<'role.created' | 'role.updated' | 'role.deleted', RoleJSON>;
6066

6167
export type PermissionWebhookEvent = Webhook<
@@ -98,6 +104,7 @@ export type WebhookEvent =
98104
| OrganizationDomainWebhookEvent
99105
| OrganizationMembershipWebhookEvent
100106
| OrganizationInvitationWebhookEvent
107+
| OrganizationInvitationAcceptedWebhookEvent
101108
| RoleWebhookEvent
102109
| PermissionWebhookEvent
103110
| WaitlistEntryWebhookEvent

0 commit comments

Comments
 (0)