Prerequisites
Understanding Webhooks
WorkOS sends webhook events to notify your application about important changes:- User and group changes in Directory Sync
- Authentication events
- Organization updates
- Connection status changes
Setting Up Webhook Endpoint
Verify Webhook Signatures
Always verify webhook signatures to ensure authenticity:The
constructEvent method:- Verifies the signature hash
- Checks the timestamp is within tolerance
- Deserializes the event data
- Throws
SignatureVerificationExceptionif verification fails