# GitLab release created notifications on your phone

> Get a push notification when a new release is created in your GitLab project.

- Company: GitLab (https://www.justpush.io/recipes/gitlab)
- Event: `Release Hook` (Releases events)
- Tags: Code hosting, Releases & app review
- Install: https://studio.justpush.io/recipes/gitlab/release
- Web page: https://www.justpush.io/recipes/gitlab/release

## Setup

1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL.
2. In your GitLab project (or group), go to Settings > Webhooks and click Add new webhook.
3. Paste your webhook URL (shown in Studio after install) as the URL.
4. Under Trigger, tick Releases events and click Add webhook. Use the Test dropdown to send a sample event.
5. Tick **Releases events** under **Trigger**. Pushes go out when a release is created; edits and deletions are ignored. A release with a future release date is marked "(upcoming)".
6. A group webhook covers every project in the group. Links in the push come from the payload, so self-managed GitLab instances work too.
7. GitLab can sign deliveries with a **Signing token** (`webhook-signature`, HMAC-SHA256) or send a plain **Secret token** (`X-Gitlab-Token`), but JustPush doesn't check either yet, so keep your endpoint URL private.

## Code

Studio calls `handleRequest(request)` with the incoming webhook (`{ method, headers, body, query, raw }`) and sends the message object it returns. Returning `null` sends nothing.

```js
// GitLab → Release Hook (release created)
// Fires when a new release is created in a project or group your webhook covers.
// Docs: https://docs.gitlab.com/user/project/integrations/webhook_events/#release-events

// Header names can arrive in any case.
function header(request, name) {
    const headers = request.headers || {}
    const key = Object.keys(headers).find((k) => k.toLowerCase() === name)
    const value = key ? headers[key] : null
    return Array.isArray(value) ? value[0] : value
}

// Only link to real http(s) URLs.
function link(url, cta) {
    return typeof url === "string" && /^https?:\/\//.test(url) ? [{ cta, url }] : []
}

function handleRequest(request) {
    const body = request.body && typeof request.body === "object" ? request.body : {}
    const event = header(request, "x-gitlab-event")

    // Guard: only release events. The header decides when it's there; the payload's
    // shape is the fallback (for example in Studio's Test runner).
    if (event ? event !== "Release Hook" : body.object_kind !== "release") {
        console.log(`Ignoring GitLab "${event ?? body.object_kind ?? "unknown"}" event`)
        return null
    }

    // Only new releases; updates and deletions are skipped. Release events keep `action` at the top level.
    if (body.action !== "create") {
        console.log(`Skipping release action "${body.action ?? "unknown"}"`)
        return null
    }

    const repo = body.project?.path_with_namespace ?? body.project?.name ?? "a project"
    const tag = body.tag ?? body.name ?? "a new version"
    const name = body.name && body.name !== body.tag ? ` — ${body.name}` : ""
    // An upcoming release has a release date in the future.
    const upcoming = typeof body.released_at === "string" && Date.parse(body.released_at) > Date.now()

    return {
        title: `${upcoming ? "🗓️" : "🚀"} ${repo} ${tag}${upcoming ? " (upcoming)" : ""}`,
        message: `Released${body.commit?.title ? ` from "${body.commit.title}"` : ""}${name}`,
        topic: "GitLab",
        priority: upcoming ? -1 : 0, // Upcoming releases are quieter than real ones
        buttons: link(body.url, "View release"),
    }
}
```

## GitLab Release Hook webhook payload (sample)

```json
{
  "id": 314,
  "tag": "v2.4.0",
  "url": "https://gitlab.example.com/acme/web/-/releases/v2.4.0",
  "name": "Faster checkout",
  "action": "create",
  "assets": {
    "count": 4,
    "links": [],
    "sources": [
      {
        "url": "https://gitlab.example.com/acme/web/-/archive/v2.4.0/web-v2.4.0.zip",
        "format": "zip"
      }
    ]
  },
  "commit": {
    "id": "ee0a3fb31ac16e11b9dbb596ad16d4af654d08f8",
    "url": "https://gitlab.example.com/acme/web/-/commit/ee0a3fb31ac16e11b9dbb596ad16d4af654d08f8",
    "title": "Release v2.4.0",
    "author": {
      "name": "Jane Doe",
      "email": "jane@example.com"
    },
    "message": "Release v2.4.0",
    "timestamp": "2026-09-28T14:50:32+02:00"
  },
  "project": {
    "id": 7,
    "name": "web",
    "web_url": "https://gitlab.example.com/acme/web",
    "namespace": "Acme",
    "default_branch": "main",
    "path_with_namespace": "acme/web"
  },
  "created_at": "2026-09-28T12:55:12.000Z",
  "description": "Faster checkout and Apple Pay.",
  "object_kind": "release",
  "released_at": "2026-09-28T12:55:12.000Z"
}
```

## FAQ

### Does this work on iPhone and Android?

Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification.

### Do I need to write code?

No. Install the recipe in Studio, paste your webhook URL into GitLab and you are done. The code is there if you want to change the text, the sound or the buttons.

### Can I change what the notification says?

Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save.

### What does it cost?

JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.
