> ## Documentation Index
> Fetch the complete documentation index at: https://trigger.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# GitLab webhooks

> Receive and verify GitLab webhooks with Trigger.dev. Check the secret token in x-gitlab-token and run a task for each GitLab event.

**`webhooks.gitlab()` checks the secret token GitLab sends in `x-gitlab-token` on every request.**

```ts /trigger/gitlab.ts theme={"theme":"css-variables"}
import { webhook, webhooks } from "@trigger.dev/sdk";

export const gitlab = webhooks.endpoint.define({
  id: "gitlab",
  source: webhooks.gitlab(),
});

export const gitlabEvents = webhook({
  id: "gitlab-events",
  endpoint: gitlab,
  onEvent: async ({ event }) => {
    console.log(event);
  },
});
```

To run a subscriber only for some events, add a [filter](https://trigger.dev/docs/webhooks/filters.md) on `header.x-gitlab-event`.

| Setting | Value |
| - | - |
| Source | `webhooks.gitlab()` |
| Verification | Shared secret in `x-gitlab-token` |
| Credential | Secret you generate on Trigger.dev |
| Event type | `header.x-gitlab-event` |
| GitLab docs | [GitLab webhook docs](https://docs.gitlab.com/user/project/integrations/webhooks/) |

## Set up GitLab

1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
2. Choose **Generate secret** on the Trigger.dev endpoint and copy the value.
3. In the GitLab project or group, go to **Settings > Webhooks** and add a webhook with the webhook URL. Paste the secret into **Secret token** and select the triggers your subscribers need. GitLab sends the event name in the `x-gitlab-event` header.
4. Send a test event from GitLab, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](https://trigger.dev/docs/webhooks/connect.md#verify-the-connection) if nothing arrives.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.