Send Knock events to Tinybird

Knock is a platform for notifications and alerts, and it provides a way to send events to Tinybird using webhooks.

Some common use cases for sending Knock events to Tinybird include:

  1. Monitor Knock message events.
  2. Run analytical workflows based on Knock events.
  3. Create custom dashboards based on Knock events.
  4. Create alerts and notifications based on Knock events.
  5. Join Knock message events with other Data Sources to enrich your user data.

Read on to learn how to send events from Knock to Tinybird.

Before you start

Before you connect Knock to Tinybird, ensure:

  • You have a Knock account.
  • You have a Tinybird Workspace.

Connect Knock to Tinybird

Knock provides a variety of webhook event types that you can use to send events to Tinybird.

This guide covers the base case for sending Knock Message events to Tinybird.

  1. In Knock, go to your repository Developers > Webhooks.

  2. Select Create webhook.

  3. Webhooks payloads vary depending on the event type. You can check here the list of Knock events.

For this guide, select events related to message.

  1. In Tinybird, create a Data Source, called knock. You can follow this schema:
SCHEMA >
  `event_time` DateTime `json:$.tinybirdIngestTime` DEFAULT now(),
  `event_type` String `json:$.type` DEFAULT 'unknown',
  `event` JSON `json:$` DEFAULT '{}'

ENGINE "MergeTree"
ENGINE_PARTITION_KEY "toYYYYMM(event_time)"
ENGINE_SORTING_KEY "event_time"

Using the JSON Data Type you can store the semi-structured data you receive from Knock in a single column. You can later retrieve various events and their metadata as needed in your Pipes.

  1. In Tinybird, copy a token with privileges to append to the Data Source you created. You can use the admin token or create one with the required scope.

  2. Back in Knock, 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.

https://api.tinybird.co/v0/events?name=knock&token=<your user token>

Replace the Tinybird API hostname or region with the API region that matches your Workspace.

  1. Select Save webhook.

  2. You're done.

Check the status of the integration from the Logs tab in the Knock webhook or from the Log tab in the Tinybird knock Data Source.

See also

Updated