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

# Send GitLab events to Tinybird

[GitLab](https://gitlab.com) is a platform for building and deploying web applications. By integrating GitLab with Tinybird, you can analyze your GitLab events in real time and enrich it with other data sources.

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

1. Analyze GitLab issues and merge requests.
2. Analyze GitLab push events.
3. Analyze and monitor GitLab pipeline.
4. Analyze custom DORA metrics.

All this allows you to build a more complete picture of your GitLab events and improve your DevOps processes.

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

## Before you start

Before you connect GitLab to Tinybird, ensure:

* You have a GitLab account.
* You have a Tinybird workspace.

## Connect GitLab to Tinybird

1. In GitLab, go to **Settings** > **Webhooks**.
   
2. Select **Add new webhook**.

3. Webhooks payloads vary depending on the event type. You can check here the list of [GitLab events](https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html).

Select **Issues Events**.

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

```tb {% title = 'Data Source schema for GitLab events %}
SCHEMA >
  `event_time` DateTime `json:$.tinybirdIngestTime` DEFAULT now(),
  `event_type` String `json:$.object_kind` 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 GitLab 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 GitLab, paste the Events API URL in your Webhook URL. Use the query parameter `name` to match the name of the data source you created in Tinybird.

```
{% user("apiHost") %}/v0/events?name=gitlab
```

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

7. Select **Add custom header** and add 'Authorization' as **Header name** and paste the token you created in Tinybird as **Header value**.

```
Bearer {% user("userToken") %}
```

8. You're done. You can select **Test** to check if the webhook is working.

Check the status of the integration from the **Log** tab in the Tinybird `gitlab` data source. 
    
## See also

* [GitLab Webhooks](https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html)
* [Tinybird data sources](https://github.com/tinybirdco/tinynest/blob/main/tinybird/datasources/)
