Skip to content

Conversation

@blackmad-cradle
Copy link
Contributor

Description

The webhook event organization_domain.created fails to deserialize

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.

@blackmad-cradle blackmad-cradle requested a review from a team as a code owner August 28, 2025 13:13
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 fixes a critical gap in the webhook event handling system by adding support for three missing organization domain webhook events: organization_domain.created, organization_domain.updated, and organization_domain.deleted.

The changes follow the established webhook pattern in the codebase where each webhook event type gets its own class that extends WebhookModel with the appropriate payload type (OrganizationDomain in this case). Each class uses a Literal type annotation to specify its exact event name, enabling Pydantic's discriminated union deserialization based on the event field.

Previously, the webhook system only supported organization_domain.verified and organization_domain.verification_failed events, but was missing the basic CRUD operations. This meant any attempt to deserialize webhooks for domain creation, updates, or deletion would fail at runtime. The fix adds the three missing webhook classes (OrganizationDomainCreatedWebhook, OrganizationDomainUpdatedWebhook, OrganizationDomainDeletedWebhook) and includes them in the main Webhook union type to enable proper deserialization.

The PR also includes minor import reorganization, grouping related imports together with blank lines between sections for better readability. This change integrates seamlessly with the existing webhook infrastructure and follows the exact same patterns used for other webhook event types throughout the codebase.

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it follows established patterns exactly
  • Score reflects simple, well-structured additions that match existing code patterns perfectly
  • No files require special attention - the changes are straightforward and follow existing conventions

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

Copy link
Member

@nicknisi nicknisi left a comment

Choose a reason for hiding this comment

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

Thank you!

@nicknisi nicknisi merged commit f9126a0 into workos:main Aug 28, 2025
5 of 8 checks passed
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