Skip to content

Conversation

@stacurry
Copy link
Contributor

@stacurry stacurry commented Aug 20, 2025

Description

Adds support for invitation.accepted and invitation.revoked events

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@linear
Copy link

linear bot commented Aug 20, 2025

@stacurry stacurry marked this pull request as ready for review August 20, 2025 22:53
@stacurry stacurry requested a review from a team August 20, 2025 22:54
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR adds support for two new webhook event types in the WorkOS Kotlin SDK: invitation.accepted and invitation.revoked. These events extend the existing invitation lifecycle management capabilities beyond the previously supported invitation.created event.

The implementation follows the established patterns in the codebase:

  1. EventType enum extension: Two new enum values InvitationAccepted and InvitationRevoked are added to the EventType enum with proper KDoc documentation and consistent string values (invitation.accepted and invitation.revoked).

  2. Webhook deserialization: The WebhookJsonDeserializer is updated to handle these new event types by adding deserialization cases that map to the existing InvitationEvent class. This reuse is appropriate since all invitation events share the same data structure containing invitation details like id, email, state, and timestamp fields.

  3. Test coverage: Comprehensive tests are added in InvitationWebhookTests.kt to verify proper webhook construction and deserialization for both new event types, following the same testing pattern as existing invitation events.

The changes integrate seamlessly with the existing webhook infrastructure. The SDK already has the necessary models (InvitationEvent, InvitationEventData) to handle these events since they share the same payload structure as the existing invitation.created event. This approach maintains consistency with the codebase architecture where event differentiation happens at the EventType level rather than requiring separate event classes.

The new enum values are positioned alphabetically within the invitation event group, maintaining the existing organization pattern in the EventType enum.

Confidence score: 5/5

  • This PR is extremely safe to merge with minimal risk of breaking existing functionality
  • Score reflects simple, well-tested changes that follow established patterns without modifying any existing logic
  • No files require special attention as all changes are straightforward additions following existing conventions

3 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@stacurry stacurry merged commit de1efa9 into main Aug 27, 2025
3 checks passed
@stacurry stacurry deleted the auth-5071-invite-events branch August 27, 2025 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants