# GitLab pipeline failed notifications on your phone > Get a High-priority push notification when a GitLab CI/CD pipeline fails, optionally with a quiet push when one passes. - Company: GitLab (https://www.justpush.io/recipes/gitlab) - Event: `Pipeline Hook` (Pipeline events) - Tags: Code hosting, Builds & CI - Install: https://studio.justpush.io/recipes/gitlab/pipeline-failed - Web page: https://www.justpush.io/recipes/gitlab/pipeline-failed ## 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 Pipeline events and click Add webhook. Use the Test dropdown to send a sample event. 5. Tick **Pipeline events** under **Trigger**. GitLab sends an event for every status change (pending, running, …), but only failed pipelines push by default. Add `?all=1` to the URL to also get a quiet push when a pipeline passes: 6. ``` 7. your webhook URL (shown in Studio after install)?all=1 8. ``` 9. A group webhook covers every project in the group. Links in the push come from the payload, so self-managed GitLab instances work too. 10. 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 → Pipeline Hook (pipeline failed) // Fires when a CI/CD pipeline fails. Add ?all=1 to the URL to also get a quiet push when one passes. // Docs: https://docs.gitlab.com/user/project/integrations/webhook_events/#pipeline-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 }] : [] } // Query flags such as ?all=1. function flag(request, name) { return ["1", "true", "yes"].includes(String(request.query?.[name] ?? "").toLowerCase()) } function handleRequest(request) { const body = request.body && typeof request.body === "object" ? request.body : {} const event = header(request, "x-gitlab-event") // Guard: only pipeline 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 !== "Pipeline Hook" : body.object_kind !== "pipeline") { console.log(`Ignoring GitLab "${event ?? body.object_kind ?? "unknown"}" event`) return null } const pipeline = body.object_attributes ?? {} // Pipelines report every status change (pending, running, …); only the end result matters. const failed = pipeline.status === "failed" const passed = pipeline.status === "success" if (!failed && !(passed && flag(request, "all"))) { console.log(`Skipping pipeline status "${pipeline.status ?? "unknown"}"`) return null } const repo = body.project?.path_with_namespace ?? body.project?.name ?? "a project" const where = [repo, pipeline.ref].filter(Boolean).join(" · ") const what = body.commit?.title ?? (typeof body.commit?.message === "string" ? body.commit.message.split("\n")[0] : null) const who = body.user?.username // Jobs that broke the pipeline (allowed failures don't count). const jobs = Array.isArray(body.builds) ? body.builds.filter((job) => job?.status === "failed" && !job.allow_failure && job.name).map((job) => job.name) : [] const number = pipeline.id ? ` #${pipeline.id}` : "" return { title: failed ? `❌ Pipeline${number} failed` : `✅ Pipeline${number} passed`, message: where + (what ? ` — ${what}` : "") + (who ? ` (@${who})` : "") + (failed && jobs.length ? ` · Failed: ${jobs.join(", ")}` : ""), topic: "GitLab", priority: failed ? 1 : -1, // High for broken pipelines, Low for the optional success pushes buttons: link(pipeline.url, "View pipeline"), } } ``` ## GitLab Pipeline Hook webhook payload (sample) ```json { "user": { "id": 42, "name": "Jane Doe", "email": "[REDACTED]", "username": "janedoe" }, "builds": [ { "id": 5510, "name": "rspec", "stage": "test", "status": "failed", "allow_failure": false, "failure_reason": "script_failure" }, { "id": 5511, "name": "lint", "stage": "test", "status": "failed", "allow_failure": true, "failure_reason": "script_failure" }, { "id": 5509, "name": "compile", "stage": "build", "status": "success", "allow_failure": false, "failure_reason": null } ], "commit": { "id": "bcbb5ec396a2c0f828686f14fac9b80b780504f2", "url": "https://gitlab.example.com/acme/web/-/commit/bcbb5ec396a2c0f828686f14fac9b80b780504f2", "title": "Fix checkout totals rounding", "author": { "name": "Jane Doe", "email": "jane@example.com" }, "message": "Fix checkout totals rounding\n\nCloses #88\n", "timestamp": "2026-09-28T11:11:50+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" }, "object_kind": "pipeline", "merge_request": null, "object_attributes": { "id": 1204, "iid": 87, "ref": "main", "sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2", "tag": false, "url": "https://gitlab.example.com/acme/web/-/pipelines/1204", "name": null, "source": "push", "stages": [ "build", "test" ], "status": "failed", "duration": 281, "created_at": "2026-09-28 09:12:03 UTC", "finished_at": "2026-09-28 09:16:44 UTC", "default_branch": true, "detailed_status": "failed" } } ``` ## 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.