Skip to content

Conversation

@blackmad-cradle
Copy link
Contributor

Description

This was entirely written by pointing claude at the workos docs because it's such manual work

  • Add 21 missing event/webhook types documented at
    https://workos.com/docs/events but absent from the SDK: api_key.created, api_key.revoked, authentication.email_verification_failed, authentication.mfa_failed, authentication.passkey_failed, authentication.passkey_succeeded, authentication.radar_risk_detected, connection.saml_certificate_renewed, connection.saml_certificate_renewal_required, flag.created, flag.updated, flag.deleted, flag.rule_updated, invitation.resent, organization_role.created, organization_role.deleted, organization_role.updated, permission.created, permission.deleted, permission.updated
  • Add 5 new payload model files (ApiKeyPayload, ConnectionSamlCertificate*Payload, FlagPayload, OrganizationRolePayload, PermissionPayload) and new auth payloads for the missing authentication events
  • Update EventType literal, Event/Webhook discriminated unions, EventPayload TypeVar, and __init__.py barrel exports

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 February 12, 2026 06:44
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 12, 2026

Greptile Overview

Greptile Summary

Added 21 missing event types from WorkOS documentation to align SDK with API capabilities. Created 5 new payload model files (ApiKeyPayload, ConnectionSamlCertificate*Payload, FlagPayload, OrganizationRolePayload, PermissionPayload) and extended authentication payloads with new failure events and SSO subdictionary. Updated all type definitions (EventType literal, Event/Webhook discriminated unions, EventPayload TypeVar) and module exports to maintain consistency across the codebase.

The changes follow existing patterns:

  • Payload models inherit from WorkOSModel with proper type annotations
  • Event/Webhook classes use EventModel/WebhookModel generics with literal discriminators
  • All additions maintain alphabetical ordering in union types and imports
  • Type definitions use discriminated unions for type-safe event handling

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • This is a straightforward additive change that adds missing event types without modifying existing functionality. All changes follow established patterns in the codebase, maintain alphabetical ordering, and properly update all necessary type definitions. The discriminated unions ensure type safety, and the changes are purely declarative type definitions with no logic that could introduce bugs.
  • Only minor style inconsistency in flag_payload.py (see inline comment)

Important Files Changed

Filename Overview
src/workos/types/events/api_key_payload.py New payload models for API key events with proper type annotations
src/workos/types/events/event.py Added 21 new event class definitions and updated Event discriminated union in alphabetical order
src/workos/types/events/event_model.py Updated EventPayload TypeVar with all 21 new payload types in alphabetical order
src/workos/types/events/event_type.py Added 21 new event type literals in alphabetical order matching WorkOS documentation
src/workos/types/events/flag_payload.py New payload model for flag events, uses generic str type for object field (inconsistent with other payloads)
src/workos/types/webhooks/webhook.py Added 21 new webhook class definitions and updated Webhook discriminated union in alphabetical order

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.

11 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile



class FlagPayload(WorkOSModel):
object: str
Copy link
Contributor

Choose a reason for hiding this comment

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

Inconsistent type annotation - use Literal["flag"] instead of str for consistency with other payload models like ApiKeyPayload, PermissionPayload, and OrganizationRolePayload

Suggested change
object: str
object: Literal["flag"]

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Add support for the following event types that were documented but
missing from the SDK:

- api_key.created, api_key.revoked
- authentication.email_verification_failed, authentication.mfa_failed,
  authentication.passkey_failed, authentication.passkey_succeeded,
  authentication.radar_risk_detected
- connection.saml_certificate_renewed,
  connection.saml_certificate_renewal_required
- flag.created, flag.updated, flag.deleted, flag.rule_updated
- invitation.resent
- organization_role.created, organization_role.deleted,
  organization_role.updated
- permission.created, permission.deleted, permission.updated

New payload models: ApiKeyPayload, ConnectionSamlCertificate payloads,
FlagPayload, OrganizationRolePayload, PermissionPayload. New auth
payloads for email_verification_failed, mfa_failed, passkey, and
radar_risk_detected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant