-
Notifications
You must be signed in to change notification settings - Fork 19
Webhooks
You can automate the creation of databases per user in the background with webhooks.
It's recommended you use ngrok.io to expose our local server to the internet so Clerk can send webhooks to it.
Install the ngrok CLI, and run the following:
ngrok http 3000Make sure to change
3000to the port your Next.js application is running on.
Inside Clerk, go to Webhooks > Add Endpoint and enter the URL provided by ngrok + /webhooks/clerk, and select user.created as the event:

Next click on the webhook you just created and copy the signing secret:

Add this signing secret to .env:
CLERK_WEBHOOK_SECRET=Now every time a user signs up, Clerk will ping your localhost:3000/webhooks/clerk via your tunnel.
Note: You will need to update the clerk endpoint each time you restart ngrok. Paid ngrok users can set a persistent URL.
You will need to deploy the app to Vercel to obtain the Deployment URL.
Once you have that, update the webhook URL in Clerk:
