# Sentry issue alert notifications on your phone

> Get a push notification when one of your Sentry issue alert rules fires, with priority based on the error's level.

- Company: Sentry (https://www.justpush.io/recipes/sentry)
- Event: `event_alert` (Issue alert)
- Tags: Developer tools, Monitoring
- Install: https://studio.justpush.io/recipes/sentry/issue-alert
- Web page: https://www.justpush.io/recipes/sentry/issue-alert

## 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 Sentry, go to Settings > Developer Settings > Custom Integrations and create an Internal Integration.
3. Paste your webhook URL (shown in Studio after install) as the Webhook URL and follow the setup notes below for Issue alert.
4. Save the integration.
5. In your internal integration (**Settings → Developer Settings → Custom Integrations**), turn on **Alert Rule Action** and save.
6. Then open an issue alert rule (**Alerts → Create Alert → Issues**, or edit an existing one) and add the action **Send a notification via _your integration_**. Every time that rule fires, you get a push.
7. Sentry signs each request with a `Sentry-Hook-Signature` header, 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
// Sentry → issue alert (event_alert)
// Fires when one of your Sentry issue alert rules triggers and its action is
// "Send a notification via <your internal integration>".
// Docs: https://docs.sentry.io/organization/integrations/integration-platform/webhooks/issue-alerts/

// Sentry levels → push priority. Fatal crashes get Highest, debug noise stays quiet.
const LEVELS = { fatal: 2, error: 1, warning: 0, info: -1, debug: -1 }

// Look a key up in one of the tables above, ignoring inherited names like "toString".
function pick(table, key, fallback) {
    return Object.prototype.hasOwnProperty.call(table, key) ? table[key] : fallback
}

// 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 event = body.data?.event

    // Guard: only issue alerts, so other Sentry webhooks on this integration stay quiet.
    if (body.action !== "triggered" || !event) {
        console.log(`Ignoring Sentry "${body.action ?? "unknown"}" webhook — not an issue alert`)
        return null
    }

    // Tags arrive as [key, value] pairs.
    const tags = Array.isArray(event.tags) ? event.tags : []
    const environment = tags.find((tag) => Array.isArray(tag) && tag[0] === "environment")?.[1]
    const rule = body.data.triggered_rule
    const details = [rule, event.culprit, environment].filter((part) => typeof part === "string" && part.trim())

    return {
        title: `🚨 ${event.title || "Sentry alert"}`,
        message: details.join(" · ") || "An issue alert triggered",
        topic: "Sentry",
        priority: pick(LEVELS, event.level, 1),
        buttons: link(event.web_url, "View in Sentry"),
    }
}
```

## Sentry event_alert webhook payload (sample)

```json
{
  "data": {
    "event": {
      "url": "https://sentry.io/api/0/projects/acme/web/events/e4874d664c3540c1a32eab185f12c5ab/",
      "tags": [
        [
          "browser",
          "Chrome 140"
        ],
        [
          "environment",
          "production"
        ],
        [
          "level",
          "error"
        ]
      ],
      "level": "error",
      "title": "TypeError: Cannot read properties of undefined (reading 'total')",
      "culprit": "app/checkout/Summary.tsx in renderTotals",
      "web_url": "https://acme.sentry.io/issues/1117540176/events/e4874d664c3540c1a32eab185f12c5ab/",
      "datetime": "2026-09-29T08:06:17.677000Z",
      "event_id": "e4874d664c3540c1a32eab185f12c5ab",
      "issue_id": "1117540176",
      "platform": "javascript",
      "issue_url": "https://sentry.io/api/0/issues/1117540176/"
    },
    "issue_alert": {
      "title": "Checkout errors",
      "settings": []
    },
    "triggered_rule": "Checkout errors"
  },
  "actor": {
    "id": "sentry",
    "name": "Sentry",
    "type": "application"
  },
  "action": "triggered",
  "installation": {
    "uuid": "a8e5d37a-696c-4c54-adb5-b3f28d64c7de"
  }
}
```

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