$npx -y skills add getsentry/sentry-for-ai --skill sentry-create-alertCreate Sentry alerts using the workflow engine API. Use when asked to create alerts, set up notifications, configure issue priority alerts, or build workflow automations. Supports email, Slack, PagerDuty, Discord, and other notification actions.
| 1 | > [All Skills](../../SKILL_TREE.md) > [Feature Setup](../sentry-feature-setup/SKILL.md) > Create Alert |
| 2 | |
| 3 | # Create Sentry Alert |
| 4 | |
| 5 | Create alerts via Sentry's workflow engine API. |
| 6 | |
| 7 | **Note:** This API is currently in **beta** and may be subject to change. It is part of New Monitors and Alerts and may not be viewable in the legacy Alerts UI. |
| 8 | |
| 9 | ## Invoke This Skill When |
| 10 | |
| 11 | - User asks to "create a Sentry alert" or "set up notifications" |
| 12 | - User wants to be emailed or notified when issues match certain conditions |
| 13 | - User mentions priority alerts, de-escalation alerts, or workflow automations |
| 14 | - User wants to configure Slack, PagerDuty, or email notifications for Sentry issues |
| 15 | |
| 16 | ## Prerequisites |
| 17 | |
| 18 | - `curl` available in shell |
| 19 | - Sentry org auth token with `alerts:write` scope (also accepts `org:admin` or `org:write`) |
| 20 | |
| 21 | ## Phase 1: Gather Configuration |
| 22 | |
| 23 | Ask the user for any missing details: |
| 24 | |
| 25 | | Detail | Required | Example | |
| 26 | |--------|----------|---------| |
| 27 | | Org slug | Yes | `sentry`, `my-org` | |
| 28 | | Auth token | Yes | `sntryu_...` (needs `alerts:write` scope) | |
| 29 | | Region | Yes (default: `us`) | `us` → `us.sentry.io`, `de` → `de.sentry.io` | |
| 30 | | Alert name | Yes | `"High Priority De-escalation Alert"` | |
| 31 | | Trigger events | Yes | Which issue events fire the workflow | |
| 32 | | Conditions | Optional | Filter conditions before actions execute | |
| 33 | | Action type | Yes | `email`, `slack`, or `pagerduty` | |
| 34 | | Action target | Yes | User email, team, channel, or service | |
| 35 | |
| 36 | ## Phase 2: Look Up IDs |
| 37 | |
| 38 | Use these API calls to resolve names to IDs as needed. |
| 39 | |
| 40 | ```bash |
| 41 | API="https://{region}.sentry.io/api/0/organizations/{org}" |
| 42 | AUTH="Authorization: Bearer {token}" |
| 43 | |
| 44 | # Find user ID by email |
| 45 | curl -s "$API/members/" -H "$AUTH" | python3 -c " |
| 46 | import json,sys |
| 47 | for m in json.load(sys.stdin): |
| 48 | if m.get('email')=='USER_EMAIL' or m.get('user',{}).get('email')=='USER_EMAIL': |
| 49 | print(m['user']['id']); break" |
| 50 | |
| 51 | # List teams |
| 52 | curl -s "$API/teams/" -H "$AUTH" | python3 -c " |
| 53 | import json,sys |
| 54 | for t in json.load(sys.stdin): |
| 55 | print(t['id'], t['slug'])" |
| 56 | |
| 57 | # List integrations (for Slack/PagerDuty) |
| 58 | curl -s "$API/integrations/" -H "$AUTH" | python3 -c " |
| 59 | import json,sys |
| 60 | for i in json.load(sys.stdin): |
| 61 | print(i['id'], i['provider']['key'], i['name'])" |
| 62 | ``` |
| 63 | |
| 64 | ## Phase 3: Build Payload |
| 65 | |
| 66 | ### Trigger Events |
| 67 | |
| 68 | Pick which issue events fire the workflow. Use `logicType: "any-short"` (triggers must always use this). |
| 69 | |
| 70 | | Type | Fires when | |
| 71 | |------|-----------| |
| 72 | | `first_seen_event` | New issue created | |
| 73 | | `regression_event` | Resolved issue recurs | |
| 74 | | `reappeared_event` | Archived issue reappears | |
| 75 | | `issue_resolved_trigger` | Issue is resolved | |
| 76 | |
| 77 | ### Filter Conditions |
| 78 | |
| 79 | Conditions that must pass before actions execute. Use `logicType: "all"`, `"any-short"`, or `"none"`. |
| 80 | |
| 81 | **The `comparison` field is polymorphic** — its shape depends on the condition `type`: |
| 82 | |
| 83 | | Type | `comparison` format | Description | |
| 84 | |------|---------------------|-------------| |
| 85 | | `issue_priority_greater_or_equal` | `75` (bare integer) | Priority >= Low(25)/Medium(50)/High(75) | |
| 86 | | `issue_priority_deescalating` | `true` (bare boolean) | Priority dropped below peak | |
| 87 | | `event_frequency_count` | `{"value": 100, "interval": "1hr"}` | Event count in time window | |
| 88 | | `event_unique_user_frequency_count` | `{"value": 50, "interval": "1hr"}` | Affected users in time window | |
| 89 | | `tagged_event` | `{"key": "level", "match": "eq", "value": "error"}` | Event tag matches | |
| 90 | | `assigned_to` | `{"targetType": "Member", "targetIdentifier": 123}` | Issue assigned to target | |
| 91 | | `level` | `{"level": 40, "match": "gte"}` | Event level (fatal=50, error=40, warning=30) | |
| 92 | | `age_comparison` | `{"time": "hour", "value": 24, "comparisonType": "older"}` | Issue age | |
| 93 | | `issue_category` | `{"value": 1}` | Category (1=Error, 6=Feedback) | |
| 94 | | `issue_occurrences` | `{"value": 100}` | Total occurrence count | |
| 95 | |
| 96 | **Interval options:** `"1min"`, `"5min"`, `"15min"`, `"1hr"`, `"1d"`, `"1w"`, `"30d"` |
| 97 | |
| 98 | **Tag match types:** `"co"` (contains), `"nc"` (not contains), `"eq"`, `"ne"`, `"sw"` (starts with), `"ew"` (ends with), `"is"` (set), `"ns"` (not set) |
| 99 | |
| 100 | Set `conditionResult` to `false` to invert (fire when condition is NOT met). |
| 101 | |
| 102 | ### Actions |
| 103 | |
| 104 | | Type | Key Config | |
| 105 | |------|-----------| |
| 106 | | `email` | `config.targetType`: `"user"` / `"team"` / `"issue_owners"`, `config.targetIdentifier`: `<id>` | |
| 107 | | `slack` | `integrationId`: `<id>`, `config.targetDisplay`: `"#channel-name"` | |
| 108 | | `pagerduty` | `integrationId`: `<id>`, `config.targetDisplay`: `<service_name>`, `data.priority`: `"critical"` | |
| 109 | | `discord` | `integrationId`: `<id>`, `data.tags`: tag list | |
| 110 | | `msteams` | `integrationId`: `<id>`, `config |