# WorkOS + Brew

Trigger Brew automations from WorkOS user, authentication, password-reset, organization, directory-sync (SCIM), connection, and invitation events.

Canonical: https://brew.new/browse/integrations/workos

- Direction: Data in
- Connection: Webhook secret
- Enterprise auth triggers

## Live capabilities

- **Event triggers**: Trigger Brew automations from WorkOS user, authentication, organization, directory sync, and connection events.

## Turn WorkOS events into useful emails

Connect WorkOS to start branded emails when a user is created, verifies their email, resets a password, joins an organization, or is provisioned through directory sync. Brew turns 18 WorkOS event types into automation triggers.

WorkOS remains responsible for SSO, directory sync, sign-in, and password resets. Brew only listens for events and creates and sends the emails that follow them.


## What you can build

- Welcome emails: user.created fires when a WorkOS user is provisioned. authentication.email_verification_succeeded fires when the user verifies their email. Choose one trigger to avoid two welcomes.
- Password-reset confirmations: password_reset.succeeded fires when a reset completes. It is a top-level WorkOS event, not part of authentication.*.
- Sign-in notices: authentication.magic_auth_succeeded fires when a magic-link sign-in completes, and authentication.password_failed fires when a password sign-in fails. Both go to the user, and neither exposes IP address or user agent as a merge tag.
- Team onboarding: organization_membership.created and invitation.accepted both fire when someone joins, and carry role. Choose one trigger to avoid two welcomes.
- Role-change notices: organization_membership.updated fires when a membership changes, such as a new role.
- Directory-synced users: dsync.user.created, dsync.user.updated, and dsync.user.deleted keep Brew contacts in step with your SCIM directory.
- Offboarding notices: user.deleted and organization_membership.deleted fire when a user is deleted or leaves an organization. user.deleted also unsubscribes the contact, and leaving an organization does not.

## Organization and connection events start no emails

organization.created, organization.updated, organization.deleted, and connection.activated carry no recipient. Brew records them in Recent events as unresolved and starts no automation.

To email a person about a new organization, use an event that carries their address, such as organization_membership.created or invitation.accepted.

Membership, authentication, and directory events without an email address can still proceed when Brew has already seen a real email for the same WorkOS user, membership, or directory user on the current connection.


## Set up WorkOS in Brew

- Open Integrations, choose WorkOS, and select Connect WorkOS.
- In the WorkOS Dashboard, open Webhooks, create an endpoint, and paste the Brew URL.
- Subscribe to the 18 supported events: user.*, authentication.email_verification_succeeded, authentication.magic_auth_succeeded, authentication.password_failed, password_reset.succeeded, organization.*, organization_membership.*, dsync.user.*, connection.activated, and invitation.accepted. Do not select authentication.*, which adds authentication events Brew does not support.
- Copy the endpoint signing secret, paste it into Brew, and select Save and connect. Brew verifies each delivery with the WorkOS signature header and a 180-second timestamp tolerance.
- In WorkOS, send a test user.created event from the endpoint. Brew changes from "Waiting for the first event" to "Connected". Brew skips the WorkOS samples it recognizes, but it may process an unrecognized sample like a real event, so send the test before you publish an automation on that trigger.
- Connecting creates triggers for all 18 events. There is no event enable/disable switch.
- Create an automation, select its WorkOS event, and send a test while it is still a Draft. Only Live automations execute when a matching event arrives.

## Supported WorkOS events

Brew supports these 18 event types:

- user.created
- user.updated
- user.deleted
- authentication.email_verification_succeeded
- authentication.password_failed
- password_reset.succeeded
- authentication.magic_auth_succeeded
- organization.created
- organization.updated
- organization.deleted
- organization_membership.created
- organization_membership.updated
- organization_membership.deleted
- dsync.user.created
- dsync.user.updated
- dsync.user.deleted
- connection.activated
- invitation.accepted

## Contact sync and personalization

Each verified event with a real email address creates or updates a Brew contact, matched by email, whether or not an automation uses the event. When the data is present, Brew sets first and last name, workos_user_id, and workos_email_verified. User events also set workos_external_id, workos_account_status, workos_created_at, workos_last_sign_in_at, and workos_avatar_url, and metadata values land as workos_metadata_<key>.

Authentication events set workos_last_verification_at, workos_last_failed_auth_at, workos_last_password_reset_at, or workos_last_magic_auth_at. Membership and invitation events set workos_organization_id, workos_org_role, and workos_org_membership_status, which is invited, active, or removed. Directory events set workos_directory_user_id, workos_directory_id, workos_job_title, and workos_account_status.

workos_account_status is active, disabled for an inactive directory user, or deleted after user.deleted or dsync.user.deleted. A deletion or a disabled directory user unsubscribes an existing contact unless it holds a different WorkOS user or directory user ID, and never creates a contact. organization_membership.deleted sets workos_org_membership_status to removed and does not unsubscribe the contact. Brew does not remove the contact.

Use the selected event's declared payload schema for merge tags. Every event includes email, firstName, lastName, and createdAt when present. User events add emailVerified, organization events add organizationName, and membership and invitation events add role. createdAt is a Unix timestamp in seconds.

WorkOS object IDs are not merge tags, and neither are the IP address and user agent on authentication events.

Directory-synced employees have usually not opted in to marketing. Treat them as recipients of account and transactional notices unless they opted in separately.


## Why does an event appear without sending an email?

Receiving an event and sending an email are separate steps. Confirm a matching automation is Live, then check its filters, execution history, recipient eligibility, and sending domain. Organization and connection events never start automations, and a recognized WorkOS test sample is recorded as a test event.


## Limits and troubleshooting

- Brew cannot create or change WorkOS users, organizations, directories, or connections.
- A 401 with timestamp_invalid:out_of_tolerance means the delivery timestamp was more than 180 seconds off. Check clock skew, then redeliver from the WorkOS Dashboard.
- If password-reset automations never fire, confirm the endpoint subscribes to password_reset.succeeded. WorkOS never sends authentication.password_reset_succeeded.
- If every delivery fails signature checks, copy the current endpoint secret from WorkOS and connect again. Brew requires the secret to be at least 16 characters.
- Review consent and the purpose of each email. Syncing WorkOS users does not authorize promotional sends.

## Sources and setup guides

- [WorkOS setup guide](https://docs.brew.new/integrations/import/workos)
- [Build an automation](https://docs.brew.new/create-emails/build-an-automation)
- [Merge tags](https://docs.brew.new/create-emails/merge-tags)
- [What you can send with Brew](https://docs.brew.new/get-started/what-you-can-send)
- [WorkOS events](https://workos.com/docs/events)

## Related

- [All integrations](https://brew.new/browse/integrations.md)
- [Sign up](https://brew.new/sign-up.md)
- Website: https://brew.new
