Skip to content

feat: Add ability to accept invitations#552

Merged
gjtorikian merged 2 commits intomainfrom
accept-invites
Feb 17, 2026
Merged

feat: Add ability to accept invitations#552
gjtorikian merged 2 commits intomainfrom
accept-invites

Conversation

@gjtorikian
Copy link
Contributor

Description

Adds the API route for Accept an invitation.

Closes #489.

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.

@gjtorikian gjtorikian requested a review from a team as a code owner February 17, 2026 16:38
@gjtorikian gjtorikian requested a review from awolfden February 17, 2026 16:38
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 17, 2026

Greptile Summary

Adds the accept_invitation method to the UserManagement module, implementing the Accept an invitation API endpoint.

  • Added INVITATION_ACCEPT_PATH constant for the API route
  • Implemented accept_invitation method in both sync (UserManagement) and async (AsyncUserManagement) classes
  • Added method signature to UserManagementModule Protocol
  • Comprehensive test coverage includes success, not found, and already accepted error cases
  • Implementation follows existing patterns (identical structure to resend_invitation and revoke_invitation)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation follows established patterns exactly, with comprehensive test coverage and proper dual sync/async support matching the codebase architecture
  • No files require special attention

Important Files Changed

Filename Overview
src/workos/user_management.py Added accept_invitation method following existing patterns for both sync and async implementations
tests/test_user_management.py Added comprehensive tests for accept_invitation covering success, not found, and already accepted cases

Sequence Diagram

sequenceDiagram
    participant Client
    participant UserManagement
    participant HTTPClient
    participant WorkOS API

    Client->>UserManagement: accept_invitation(invitation_id)
    UserManagement->>HTTPClient: request(INVITATION_ACCEPT_PATH, POST)
    HTTPClient->>WorkOS API: POST /user_management/invitations/{id}/accept
    
    alt Success (200)
        WorkOS API-->>HTTPClient: Invitation object
        HTTPClient-->>UserManagement: Response data
        UserManagement-->>Client: Invitation (validated)
    else Not Found (404)
        WorkOS API-->>HTTPClient: Error: "Invitation not found"
        HTTPClient-->>UserManagement: Exception
        UserManagement-->>Client: Exception
    else Already Accepted (400)
        WorkOS API-->>HTTPClient: Error: "Invite has already been accepted"
        HTTPClient-->>UserManagement: Exception
        UserManagement-->>Client: Exception
    end
Loading

Last reviewed commit: bdc7027

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.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@gjtorikian gjtorikian merged commit 47b34e9 into main Feb 17, 2026
11 checks passed
@gjtorikian gjtorikian deleted the accept-invites branch February 17, 2026 17:00
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.

Add support for Accept Invitation API method

2 participants

Comments