# On Sentry event

> For AI agents: the complete documentation index is at https://buddy.works/llms.txt

Sentry event triggers run a pipeline when an issue is created or resolved in Sentry. Filter by project, level, status, event count, and affected users.

Sentry event triggers run a pipeline when a supported event occurs for a Sentry issue. The pipeline runs when the event and issue match the configured trigger and filters. For example, you can roll back a release when a `fatal` issue appears in production or notify the team when an issue is resolved.

The trigger supports the following Sentry issue events:

- `created` - a new issue was created
- `resolved` - an issue was resolved

> **Info**
>
> The trigger requires a [Sentry integration](https://buddy.works/docs/integrations/sentry.md). Events are delivered through the integration selected in the trigger.

## Configure trigger

1. Open the pipeline and go to the **Workflow** tab.
2. Click **+** in the **Triggers** section and select the **Sentry** trigger.
3. Select the **Integration** and the events that should trigger the pipeline.
4. Add filters to restrict which issues can trigger the pipeline, if needed.
5. Click **Apply changes**.

## Filters

- **Projects** - Sentry projects the issue belongs to.
- **Levels** - severity levels of the issue, e.g. `error`, `fatal`.
- **Statuses** and **Substatuses** - status and substatus of the issue, for example `unresolved` with the `new` or `escalating` substatus.
- **Count** - the minimum number of times the issue has occurred.
- **User count** - the minimum number of affected users.
- **Snooze** - prevents the same issue from triggering the pipeline more than once within the configured time window. The value is set in minutes, up to 20160 (14 days).

> **Warning**
>
> **Count** and **User count** are compared with the values included in the event. Sentry sends the `created` event once per issue, usually with a count of `1`, and does not send another `created` event when the count later reaches the configured threshold. For `resolved` events, these values contain the totals at the time of resolution.

## YAML

The event type is `SENTRY`. The `integration` field requires the integration **identifier**, not its display name:

```yaml
- pipeline: "Roll back on fatal error"
  events:
    - type: "SENTRY"
      integration: "my-sentry"
      projects:
        - "backend"
      levels:
        - "fatal"
      events:
        - "created"
      snooze_minutes: 60
  actions:
    - action: "Roll back release"
      type: "SSH_COMMAND"
      targets:
        - "prod-server"
      commands: |-
        ./rollback.sh
    - action: "Notify team"
      type: "SLACK"
      integration: "slack"
      channel: "C0123456789"
      content: "Rolled back after $BUDDY_RUN_SENTRY_TITLE in $BUDDY_RUN_SENTRY_PROJECT"
```

In this example the pipeline starts when a new `fatal` issue appears in the `backend` project. The same issue will not start the pipeline again for 60 minutes.

## Variables

A run started by a Sentry event receives these variables:

| **Name** | **Description** |
| :--- | :--- |
| `BUDDY_RUN_SENTRY_EVENT` | Sentry event that triggered the run, for example `created` |
| `BUDDY_RUN_SENTRY_ISSUE_ID` | Identifier of the issue in Sentry |
| `BUDDY_RUN_SENTRY_TITLE` | Title of the issue |
| `BUDDY_RUN_SENTRY_URL` | API URL of the issue (`https://sentry.io/api/0/...`). The link to the issue in Sentry is `data.issue.web_url` in the payload |
| `BUDDY_RUN_SENTRY_PROJECT` | Sentry project the issue belongs to |
| `BUDDY_RUN_SENTRY_LEVEL` | Severity level of the issue |
| `BUDDY_RUN_SENTRY_STATUS` | Status of the issue |
| `BUDDY_RUN_SENTRY_SUBSTATUS` | Substatus of the issue. Not exported for `resolved` |
| `BUDDY_RUN_SENTRY_COUNT` | Number of times the issue occurred |
| `BUDDY_RUN_SENTRY_USER_COUNT` | Number of users affected by the issue |
| `BUDDY_RUN_SENTRY_ASSIGNED_TO` | Person the issue is assigned to. Not exported when the issue is unassigned |
| `BUDDY_RUN_SENTRY_PAYLOAD` | Body of the Sentry webhook that started the run |

## See also

- [Sentry integration](https://buddy.works/docs/integrations/sentry.md)
- [On ClickUp event](https://buddy.works/docs/pipelines/introduction/triggering-pipelines/on-clickup-event.md)
- [On unit test event](https://buddy.works/docs/pipelines/introduction/triggering-pipelines/on-unit-test-event.md)
- [Conditional runs](https://buddy.works/docs/pipelines/conditional-executions.md)


---
Original source: https://buddy.works/docs/pipelines/introduction/triggering-pipelines/on-sentry-event