---
id: guides-send-knock-events-to-tinybird
title: Send Knock Events to Tinybird
meta:
    description: Learn how to send Knock events to Tinybird using webhooks and the Events API.
---

# Send Knock events to Tinybird

[Knock](https://knock.app) 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](https://docs.knock.app/developer-tools/outbound-webhooks/event-types#message-events) 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](https://docs.knock.app/developer-tools/outbound-webhooks/event-types#message-events). 

For this guide, select events related to `message`.

4. In your Tinybird project, create a data source called `knock`. You can follow this [schema](https://github.com/tinybirdco/tinynest/blob/main/tinybird/datasources/knock.datasource):

```tb {% title = 'Data Source schema for Knock events %}
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](/sql-reference/data-types/json) 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.

{% callout type="caution" %}
The `JSON` data type is in private beta. If you are interested in using this type, contact Tinybird at <support@tinybird.co> or in the [Community Slack](/community).
{% /callout %}

5. From Tinybird Cloud, 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.

6. 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.

```
{% user("apiHost") %}/v0/events?name=knock&token={% user("userToken") %}
```

{% snippet title="api-region-reminder" /%}

7. Select **Save webhook**.

8. 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

* [Knock Webhooks](https://docs.knock.app/developer-tools/outbound-webhooks/overview)
