# Linear SLA at risk or breached notifications on your phone

> Get a push notification when a Linear issue's SLA is at high risk, and a Highest-priority one when it's breached.

- Company: Linear (https://www.justpush.io/recipes/linear)
- Event: `IssueSLA` (Issue SLA)
- Tags: Developer tools, Monitoring
- Install: https://studio.justpush.io/recipes/linear/sla-breach
- Web page: https://www.justpush.io/recipes/linear/sla-breach

## 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 Linear, go to Settings > API and click New webhook (workspace admins only).
3. Paste your webhook URL (shown in Studio after install) as the URL and pick the team (or all public teams).
4. Tick the Issue SLA resource type and save.
5. Create a webhook under **Settings → API → New webhook** with the URL above and tick **Issue SLA**. SLAs must be enabled for the team.
6. The sample is modelled on Linear's schema; the SLA event's exact type name isn't documented, so the recipe checks the `highRisk`/`breached` action and the issue data instead.
7. Linear signs deliveries with `Linear-Signature` (HMAC-SHA256), but JustPush doesn't check it 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
// Linear → issue SLA at risk or breached
// Fires when an issue with an SLA is at high risk of breaching, or has breached it.
// Docs: https://linear.app/developers/webhooks

// 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 || {}
    const data = body.data ?? {}

    const issue = body.issueData ?? data

    // Guard: only SLA warnings and breaches (the "set" action just starts the clock).
    if (!["highRisk", "breached"].includes(body.action) || !issue?.title) {
        console.log(`Ignoring Linear ${body.type ?? "unknown"} ${body.action ?? ""}`)
        return null
    }

    const breached = body.action === "breached"

    return {
        title: `${breached ? "🚨 SLA breached" : "⏰ SLA at risk"}: ${issue.identifier ?? "issue"}`,
        message: [issue.title, issue.assignee?.name, issue.team?.key].filter(Boolean).join(" · "),
        topic: "Linear",
        priority: breached ? 2 : 1, // A breached SLA is a promise to a customer already broken
        buttons: link(issue.url ?? body.url, "Open issue"),
    }
}
```

## Linear IssueSLA webhook payload (sample)

```json
{
  "url": "https://linear.app/acme/issue/ENG-123/checkout-total-is-off-by-one-cent",
  "type": "IssueSLA",
  "action": "breached",
  "createdAt": "2026-09-29T09:00:00.000Z",
  "issueData": {
    "id": "2174add1-f7c8-44e3-bbf3-2d60b5ea8bc9",
    "url": "https://linear.app/acme/issue/ENG-123/checkout-total-is-off-by-one-cent",
    "team": {
      "id": "t1",
      "key": "ENG",
      "name": "Engineering"
    },
    "state": {
      "id": "s-todo",
      "name": "Todo",
      "type": "unstarted",
      "color": "#e2e2e2"
    },
    "title": "Checkout total is off by one cent",
    "labels": [],
    "number": 123,
    "assignee": {
      "id": "u2",
      "name": "Sam Lee"
    },
    "priority": 1,
    "createdAt": "2026-09-29T09:00:00.000Z",
    "identifier": "ENG-123",
    "priorityLabel": "Urgent"
  },
  "webhookId": "000042e3-d123-4980-b49f-8e140eef9329",
  "organizationId": "dc844923-f9a4-40a3-825c-dea7747e57d6",
  "webhookTimestamp": 1790672400000
}
```

## 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 Linear 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.
