Clerk
Set up webhooks to receive notifications for user authentication events from Clerk
Integration Guide
This guide will walk you through setting up a webhook integration between Clerk and HookFlo, enabling you to receive alerts for user authentication and management events.
Clerk uses Svix to manage their webhook infrastructure, so the webhooks will include Svix-specific headers that HookFlo will validate.
Prerequisites
- A HookFlo account with an active project
- A Clerk account with admin access to your application
- Basic understanding of Clerk’s authentication system
Integration Overview
The integration process follows these key steps:
- Set up a webhook in HookFlo
- Configure notification channels (email/Slack)
- Connect Clerk to HookFlo
- Configure Clerk to send webhooks
- Test the integration
Setting Up Your HookFlo Webhook
After logging into HookFlo, follow these steps to create and configure your Clerk webhook:
Create a Webhook
Setting Up Your Webhook Endpoint
Setting Up Your Webhook Endpoint
- From your Hookflo Dashboard, navigate to > Manage Webhooks
- Click on + Create Webhook
- Your webhook will be created in an inactive state by default
Once created, you’ll see your webhook in manage webhooks table.
Setup Notification Channel
Configure Email Notifications
Configure Email Notifications
- Toggle the Email Notifications switch to enable email alerts
- In the dialog box that appears, enter the email address where you want to receive notifications
- Select an email template from the dropdown menu
- Click Preview Template to see how your notifications will look
- Use the editor to customize the template if needed
- Click Save Configuration to confirm your settings
Email notifications are perfect for critical alerts that require immediate attention and have lower usage limits. Use it for critical alerts.
Configure Slack Notifications
Configure Slack Notifications
- Toggle the Slack Notifications switch to enable Slack alerts
- In the dialog box, paste your Slack webhook URL (see How to Get a Slack Webhook URL)
- Keep the random generated name or enter a custom one (optional)
- Select a notification template from the available options
- Preview and edit the template as needed
- Click Save Configuration to confirm your settings
Slack notifications are ideal for team collaboration and awareness. Highly recommended to use Slack as it has 3x usage limits compared to email.
Connect your Webhook with application
Configure Application
Configure Application
- Click the Connect button to activate your webhook
- Select Clerk as application to integrate
- A configuration panel will appear with your webhook credentials:
- Webhook URL: The HTTP POST request endpoint Clerk will send events to
- Signing Secret: Signing Secret generated by Clerk
- You’ll need to add your Clerk Signing Secret in the next steps
- Copy the Webhook URL for the next section
You can also configure notification channels from this panel if you haven’t done so already.
Configuring Clerk
Now that your HookFlo webhook is set up, you need to configure Clerk to send events to it:
Create a Webhook Endpoint in Clerk
Configuring Clerk to Send Webhooks
Configuring Clerk to Send Webhooks
- Log in to your Clerk Dashboard
- Select your application
- Navigate to Configure Tab > Select Webhooks in the left sidebar
- Click Add Endpoint
- Enter your HookFlo webhook URL that you copied from the previous step
- Under Message filtering, select the events you want to monitor:
- For user events:
user.created
,user.updated
,user.deleted
, etc. - For session events:
session.created
,session.removed
, etc. - For authentication events:
emailAddress.verified
,password.reset
, etc.
- For user events:
- Click Create
Get Signing Secret from Clerk
Obtaining Your Signing Secret
Obtaining Your Signing Secret
After creating the webhook endpoint in Clerk:
- In your Clerk dashboard, find your newly created webhook endpoint
- Locate the Signing Secret section
- Click Reveal to view the secret
- Copy the signing secret
This secret is crucial for verifying that webhook events are genuinely from Clerk.
Configure Webhook Verification in HookFlo
Setting Up Webhook Verification
Setting Up Webhook Verification
- Return to the HookFlo dashboard
- Navigate to your Clerk webhook configuration
- Find the “Signing Secret” field
- Paste the Clerk signing secret you copied
- Click Save Configuration
This step completes the secure connection between Clerk and HookFlo.
Testing Your Integration
To ensure your integration is working properly:
Test the Webhook in Clerk
Generating Test Events
Generating Test Events
- In the Clerk dashboard, find your webhook endpoint
- Click Send test event
- Select an event type (e.g.,
user.created
) - Click Send test to deliver a sample webhook to HookFlo
Verify in HookFlo
Validate Alert Delivery
Validate Alert Delivery
- Return to your HookFlo dashboard
- Navigate to Notification Logs
- You should see the test events appear with details about the changes
- If you’ve configured notification channels, check your email or Slack for alerts
This confirms that your Clerk webhook is correctly sending events to HookFlo, and your notification channels are properly configured.
Supported Events
Clerk supports a wide range of webhook events. Here are the most commonly used categories:
User Events
user.created
: When a new user is createduser.updated
: When user details are changeduser.deleted
: When a user is deleteduser.locked
: When a user account is locked
Session Events
session.created
: When a user signs insession.removed
: When a user signs outsession.ended
: When a session expires
Authentication Events
emailAddress.created
: When an email address is addedemailAddress.verified
: When an email is verifiedphoneNumber.created
: When a phone number is addedphoneNumber.verified
: When a phone is verifiedpassword.created
: When a password is setpassword.reset
: When a password is reset
Organization Events
organization.created
: When a new organization is createdorganization.updated
: When an organization is updatedorganization.deleted
: When an organization is deletedorganizationMembership.created
: When a user joins an organizationorganizationMembership.deleted
: When a user leaves an organization
For a complete list of events, refer to the Clerk Webhook Events documentation.
Webhook Headers
Clerk webhooks include these important headers that HookFlo uses for verification:
svix-id
: A unique identifier for the webhook eventsvix-timestamp
: When the webhook was sentsvix-signature
: A signature that proves the webhook came from Clerk
Webhook Payload Structure
Here’s an example of what the webhook payload looks like for a user.created
event:
Advanced Configuration
Customizing Notification Templates
Customizing Notification Templates
Handling Test vs. Production Events
Handling Test vs. Production Events
Clerk allows you to differentiate between test and production environments:
- Set up separate webhooks in HookFlo for test and production environments
- Use clear naming conventions to distinguish between test and production webhooks
- Configure different notification channels for test vs. production events
This separation helps prevent confusion between test data and real user events.
Troubleshooting
Webhook Verification Failures
Webhook Verification Failures
If you’re seeing webhook verification errors:
- Double-check that you’ve entered the correct signing secret in HookFlo
- Ensure the secret is from the same endpoint where you configured the HookFlo URL
- Check if the signing secret has been rotated in Clerk recently
- Verify your server’s clock is accurately synchronized (time drift can cause verification failures)
Missing Events
Missing Events
If certain events aren’t being received:
- Verify that you’ve selected those specific event types in Clerk’s webhook configuration
- Check Clerk’s webhook delivery logs to confirm they’re being sent
- Ensure your HookFlo webhook is active and properly configured
Webhook Timeouts
Webhook Timeouts
If webhook deliveries are timing out:
- Check Clerk’s webhook logs for timeout errors
- Consider implementing webhook retries in Clerk’s settings
- Contact HookFlo support if the issue persists
Example: Monitoring New User Signups
Here’s a complete example of setting up HookFlo to alert your team when new users sign up:
Create the Webhook in HookFlo
Follow the steps above to create a Clerk webhook in HookFlo and configure your notification channels.
Configure Clerk to Send User Events
- In your Clerk dashboard, go to Webhooks
- Create a new webhook using your HookFlo webhook URL
- Select the
user.created
event type - Copy your webhook signing secret
- Add the signing secret to your HookFlo Clerk configuration
Test With a New User
- Create a new test user in your Clerk application
- Check your configured notification channels for alerts
- Verify the event appears in your HookFlo notification logs
Security Considerations
When setting up webhook integrations between Clerk and HookFlo, keep these security best practices in mind:
- Protect your signing secret: Never expose the Clerk signing secret in client-side code
- Validate all webhooks: Always use the signing secret to verify webhook authenticity
- Use HTTPS only: Ensure all webhook URLs use encrypted connections
- Implement proper access controls: Limit who can view sensitive user information
- Monitor webhook activity: Regularly review webhook events for suspicious patterns
Congratulations! 🎉
You’ve successfully set up real-time authentication event tracking and alerting between Clerk and HookFlo in just a few minutes. Your team can now receive immediate notifications about important user events, helping you respond quickly to critical situations.
Need more help? Contact our support team or join our Discord forum or DM me directly on X.