Skip to content

feat: Add locale param to send/resend invitation methods#1460

Merged
jasonbarry merged 4 commits intomainfrom
feat/invitation-locale
Feb 3, 2026
Merged

feat: Add locale param to send/resend invitation methods#1460
jasonbarry merged 4 commits intomainfrom
feat/invitation-locale

Conversation

@jasonbarry
Copy link
Contributor

@jasonbarry jasonbarry commented Feb 3, 2026

Description

This PR adds node SDK support for the locale prop in sendInvitation() and resendInvitation() user management methods. This recently landed in the API here.

Documentation

Docs are ready to go here: https://github.com/workos/workos/pull/51227

@jasonbarry jasonbarry self-assigned this Feb 3, 2026
@jasonbarry jasonbarry changed the title add locale param to send/resend invitation methods feat: Add locale param to send/resend invitation methods Feb 3, 2026
@jasonbarry jasonbarry marked this pull request as ready for review February 3, 2026 17:42
@jasonbarry jasonbarry requested a review from a team as a code owner February 3, 2026 17:42
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 3, 2026

Greptile Overview

Greptile Summary

This PR adds support for the optional locale parameter to the sendInvitation() and resendInvitation() methods in the WorkOS Node SDK, enabling users to specify the language for invitation emails.

Key Changes:

  • Added Locale type with 88 supported language codes (e.g., en, es, fr-CA, zh-CN)
  • Updated sendInvitation() to accept optional locale field in the options
  • Updated resendInvitation() to accept optional second parameter for options (including locale)
  • Maintained full backward compatibility - resendInvitation(id) still works without options
  • Added comprehensive test coverage for both methods with locale parameter
  • Created proper serializers to transform camelCase to snake_case for API requests

Implementation Quality:

  • Clean TypeScript interfaces with proper type safety
  • Follows existing codebase patterns and conventions
  • Proper separation of concerns with dedicated serializers
  • Thorough test coverage including error cases (422 invalid locale)

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • The implementation is well-structured, follows existing patterns, maintains backward compatibility, includes comprehensive tests, and introduces no security concerns. The type-safe Locale union prevents invalid values at compile time.
  • No files require special attention

Important Files Changed

Filename Overview
src/user-management/interfaces/locale.interface.ts Added comprehensive Locale type definition with 88 language codes
src/user-management/user-management.spec.ts Added comprehensive tests for locale parameter in send and resend invitation methods
src/user-management/user-management.ts Updated resendInvitation method to accept optional locale parameter while maintaining backward compatibility

Sequence Diagram

sequenceDiagram
    participant Client
    participant UserManagement
    participant Serializer
    participant API
    
    Note over Client,API: Send Invitation Flow
    Client->>UserManagement: sendInvitation({email, locale})
    UserManagement->>Serializer: serializeSendInvitationOptions(options)
    Serializer-->>UserManagement: {email, locale, ...}
    UserManagement->>API: POST /user_management/invitations
    API-->>UserManagement: InvitationResponse
    UserManagement-->>Client: Invitation
    
    Note over Client,API: Resend Invitation Flow
    Client->>UserManagement: resendInvitation(id, {locale})
    UserManagement->>Serializer: serializeResendInvitationOptions(options)
    Serializer-->>UserManagement: {locale}
    UserManagement->>API: POST /user_management/invitations/{id}/resend
    API-->>UserManagement: InvitationResponse
    UserManagement-->>Client: Invitation
    
    Note over Client,API: Backward Compatible Flow
    Client->>UserManagement: resendInvitation(id)
    UserManagement->>API: POST /user_management/invitations/{id}/resend
    Note right of UserManagement: Empty object {} sent when no options
    API-->>UserManagement: InvitationResponse
    UserManagement-->>Client: Invitation
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.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@jasonbarry jasonbarry merged commit ff2e816 into main Feb 3, 2026
8 checks passed
@jasonbarry jasonbarry deleted the feat/invitation-locale branch February 3, 2026 18:42
@gjtorikian gjtorikian mentioned this pull request Feb 3, 2026
gjtorikian added a commit that referenced this pull request Feb 3, 2026
## Description

This release has two new features:

* #1458
* #1460

and one bug fix:

* #1461

## Documentation

Does this require changes to the WorkOS Docs? E.g. the [API
Reference](https://workos.com/docs/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.
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