Skip to content

Conversation

@ohjonah
Copy link

@ohjonah ohjonah commented Nov 27, 2025

Description

  • Add OrganizationCreated, OrganizationUpdated, and OrganizationDeleted event types
  • Create OrganizationCreatedEvent, OrganizationUpdatedEvent, and OrganizationDeletedEvent classes
  • Update WebhookJsonDeserializer to handle organization events
  • Add comprehensive tests for all three organization webhook events
  • All tests passing

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.

- Add OrganizationCreated, OrganizationUpdated, and OrganizationDeleted event types
- Create OrganizationCreatedEvent, OrganizationUpdatedEvent, and OrganizationDeletedEvent classes
- Update WebhookJsonDeserializer to handle organization events
- Add comprehensive tests for all three organization webhook events
- All tests passing
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 27, 2025

Greptile Overview

Greptile Summary

Added support for three new organization webhook events (organization.created, organization.updated, organization.deleted) following the existing webhook event pattern in the SDK.

  • Added OrganizationCreated, OrganizationUpdated, and OrganizationDeleted enum values to EventType
  • Created three new event classes that extend WebhookEvent and use the existing Organization model
  • Updated WebhookJsonDeserializer to handle deserialization for all three organization event types
  • Added comprehensive test coverage with proper webhook signature verification

The implementation is clean, follows established patterns in the codebase, and maintains consistency with other webhook event implementations like UserCreatedEvent and ConnectionActivatedEvent. All tests are passing and no security concerns were identified.

Confidence Score: 5/5

  • This PR is safe to merge with no concerns
  • The changes are straightforward and follow established patterns perfectly. All three event types mirror existing implementations, deserialization is properly handled, and comprehensive tests verify the functionality. No security issues, no custom rule violations, and no deviations from codebase conventions.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/main/kotlin/com/workos/webhooks/models/EventType.kt 5/5 Added three new enum values for organization webhook events (created, updated, deleted) with proper documentation
src/main/kotlin/com/workos/webhooks/models/WebhookJsonDeserializer.kt 5/5 Added deserialization support for three organization event types with proper Organization model mapping
src/test/kotlin/com/workos/test/webhooks/OrganizationWebhookTests.kt 5/5 Comprehensive test coverage for all three organization webhook events with proper signature verification

Sequence Diagram

sequenceDiagram
    participant Client as Client Application
    participant Webhook as Webhook Handler
    participant Deserializer as WebhookJsonDeserializer
    participant EventType as EventType Enum
    participant OrgEvent as Organization Event Classes

    Client->>Webhook: Receive webhook payload (organization.created/updated/deleted)
    Webhook->>Webhook: Verify signature and timestamp
    Webhook->>Deserializer: deserialize(JsonParser)
    Deserializer->>Deserializer: Extract id, eventType, data, createdAt
    Deserializer->>EventType: Match event type
    alt OrganizationCreated
        Deserializer->>OrgEvent: Create OrganizationCreatedEvent
    else OrganizationUpdated
        Deserializer->>OrgEvent: Create OrganizationUpdatedEvent
    else OrganizationDeleted
        Deserializer->>OrgEvent: Create OrganizationDeletedEvent
    end
    Deserializer->>Deserializer: deserializeData(Organization::class.java)
    Deserializer->>Webhook: Return typed WebhookEvent
    Webhook->>Client: Return OrganizationCreatedEvent/UpdatedEvent/DeletedEvent
Loading

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.

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

2 participants