Send Clerk webhooks to Tinybird¶
Clerk is a developer-focused user management platform to handle user authentication with many prebuilt UI components. By integrating Clerk with Tinybird, you can analyze your user authentication data in real time and enrich it with other data sources.
Some common use cases for sending Clerk webhooks to Tinybird include:
- Tracking net user and organization growth.
- Monitoring user churn.
- Identifying common auth errors.
- Creating custom dashboards for auth analysis.
- Enriching other data sources with real-time auth metrics.
Read on to learn how to send data from Clerk to Tinybird.
Before you start¶
Before you connect Clerk to Tinybird, ensure:
- You have a Clerk account.
- You have a Tinybird Workspace.
Connect Clerk to Tinybird¶
From the Clerk UI, select Configure > Webhooks.
Select Add Endpoint.
In Tinybird, create a Data Source, called
clerk
in this example, with the following schema:
SCHEMA > 'ingest_timestamp' DateTime `json:$.time` DEFAULT now(), 'record' JSON `json:$` ENGINE "MergeTree" ENGINE_SORTING_KEY "ingest_timestamp" ENGINE_TTL "" ENGINE_PARTITION_KEY ""
Using the JSON Data Type you can store the semi-structured data you receive from Clerk in a single column. You can later retrieve various events and their metadata as needed in your Pipes.
- Back in Clerk, paste the Events API URL in your Webhook Endpoint URL. Use the query parameter
name
to match the name of the Data Source you created in Tinybird, for example:
https://europe-west3.tinybird.co/v0/events?name=clerk
Replace the Tinybird API hostname or region with the API region that matches your Workspace.
Return to Tinybird, and copy a token with privileges to write to the Data Source you created. You can use the admin token or create one with the required scope.
Return to the Clerk Webhooks page, and update the URL to add a new search parameter
token
with the token you copied. The final URL looks like the following:
https://europe-west3.tinybird.co/v0/events?name=clerk&token=p.eyXXXXX
Select the checkboxes for the Clerk events you want to send to Tinybird, and select Create.
You're done. Any of the Clerk events you selected is automatically sent to Tinybird through the Events API. You can test the integration from the Testing tab in the Clerk Webhooks UI.