sentry-create-alert by getsentry/sentry-agent-skills
npx skills add https://github.com/getsentry/sentry-agent-skills --skill sentry-create-alert通过 Sentry 的工作流引擎 API 创建告警。
注意: 此 API 目前处于 测试版,可能会发生变化。它是新监控和告警功能的一部分,可能在旧版告警 UI 中不可见。
curlalerts:write 作用域的 Sentry 组织认证令牌(也接受 org:admin 或 org:write)向用户询问任何缺失的详细信息:
| 详情 | 必需 | 示例 |
|---|---|---|
| 组织标识符 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 是 |
sentry, my-org |
| 认证令牌 | 是 | sntryu_...(需要 alerts:write 作用域) |
| 区域 | 是(默认:us) | us → us.sentry.io, de → de.sentry.io |
| 告警名称 | 是 | "高优先级降级告警" |
| 触发事件 | 是 | 哪些问题事件会触发工作流 |
| 条件 | 可选 | 在执行操作前必须通过的过滤条件 |
| 操作类型 | 是 | email, slack 或 pagerduty |
| 操作目标 | 是 | 用户邮箱、团队、频道或服务 |
根据需要,使用这些 API 调用将名称解析为 ID。
API="https://{region}.sentry.io/api/0/organizations/{org}"
AUTH="Authorization: Bearer {token}"
# 通过邮箱查找用户 ID
curl -s "$API/members/" -H "$AUTH" | python3 -c "
import json,sys
for m in json.load(sys.stdin):
if m.get('email')=='USER_EMAIL' or m.get('user',{}).get('email')=='USER_EMAIL':
print(m['user']['id']); break"
# 列出团队
curl -s "$API/teams/" -H "$AUTH" | python3 -c "
import json,sys
for t in json.load(sys.stdin):
print(t['id'], t['slug'])"
# 列出集成(用于 Slack/PagerDuty)
curl -s "$API/integrations/" -H "$AUTH" | python3 -c "
import json,sys
for i in json.load(sys.stdin):
print(i['id'], i['provider']['key'], i['name'])"
选择哪些问题事件会触发工作流。使用 logicType: "any-short"(触发器必须始终使用此设置)。
| 类型 | 触发时机 |
|---|---|
first_seen_event | 创建新问题时 |
regression_event | 已解决的问题再次出现时 |
reappeared_event | 已归档的问题重新出现时 |
issue_resolved_trigger | 问题被解决时 |
在执行操作前必须通过的条件。使用 logicType: "all", "any-short" 或 "none"。
comparison 字段是多态的 — 其格式取决于条件 type:
| 类型 | comparison 格式 | 描述 |
|---|---|---|
issue_priority_greater_or_equal | 75(纯整数) | 优先级 >= 低(25)/中(50)/高(75) |
issue_priority_deescalating | true(纯布尔值) | 优先级降至峰值以下 |
event_frequency_count | {"value": 100, "interval": "1hr"} | 时间窗口内的事件计数 |
event_unique_user_frequency_count | {"value": 50, "interval": "1hr"} | 时间窗口内受影响的用户数 |
tagged_event | {"key": "level", "match": "eq", "value": "error"} | 事件标签匹配 |
assigned_to | {"targetType": "Member", "targetIdentifier": 123} | 问题分配给目标 |
level | {"level": 40, "match": "gte"} | 事件级别(致命=50,错误=40,警告=30) |
age_comparison | {"time": "hour", "value": 24, "comparisonType": "older"} | 问题存在时长 |
issue_category | {"value": 1} | 类别(1=错误,6=反馈) |
issue_occurrences | {"value": 100} | 总发生次数 |
间隔选项: "1min", "5min", "15min", "1hr", "1d", "1w", "30d"
标签匹配类型: "co"(包含), "nc"(不包含), "eq", "ne", "sw"(以...开头), "ew"(以...结尾), "is"(已设置), "ns"(未设置)
将 conditionResult 设置为 false 以反转条件(当条件不满足时触发)。
| 类型 | 关键配置 |
|---|---|
email | config.targetType: "user" / "team" / "issue_owners", config.targetIdentifier: <id> |
slack | integrationId: <id>, config.targetDisplay: "#频道名称" |
pagerduty | integrationId: <id>, config.targetDisplay: <服务名称>, data.priority: "critical" |
discord | integrationId: <id>, data.tags: 标签列表 |
msteams | integrationId: <id>, config.targetDisplay: <频道> |
opsgenie | integrationId: <id>, data.priority: "P1"-"P5" |
jira | integrationId: <id>, data: 项目/问题配置 |
github | integrationId: <id>, data: 仓库/问题配置 |
{
"name": "<告警名称>",
"enabled": true,
"environment": null,
"config": { "frequency": 30 },
"triggers": {
"logicType": "any-short",
"conditions": [
{ "type": "first_seen_event", "comparison": true, "conditionResult": true }
],
"actions": []
},
"actionFilters": [{
"logicType": "all",
"conditions": [
{ "type": "issue_priority_greater_or_equal", "comparison": 75, "conditionResult": true },
{ "type": "event_frequency_count", "comparison": {"value": 50, "interval": "1hr"}, "conditionResult": true }
],
"actions": [{
"type": "email",
"integrationId": null,
"data": {},
"config": {
"targetType": "user",
"targetIdentifier": "<用户_id>",
"targetDisplay": null
},
"status": "active"
}]
}]
}
frequency:重复通知之间的分钟数。允许的值:0, 5, 10, 30, 60, 180, 720, 1440。
结构说明: triggers.actions 始终为 [] — 操作位于 actionFilters[].actions 内。
curl -s -w "\n%{http_code}" -X POST \
"https://{region}.sentry.io/api/0/organizations/{org}/workflows/" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{payload}'
预期 HTTP 状态码 201。响应包含工作流 id。
确认告警已创建并提供 UI 链接:
https://{org_slug}.sentry.io/monitors/alerts/{workflow_id}/
如果组织缺少 workflow-engine-ui 功能标志,告警将出现在:
https://{org_slug}.sentry.io/alerts/rules/
# 列出所有工作流
curl -s "$API/workflows/" -H "$AUTH"
# 获取一个工作流
curl -s "$API/workflows/{id}/" -H "$AUTH"
# 更新一个工作流
curl -s -X PUT "$API/workflows/{id}/" -H "$AUTH" -H "Content-Type: application/json" -d '{payload}'
# 删除一个工作流
curl -s -X DELETE "$API/workflows/{id}/" -H "$AUTH"
# 预期 204
| 问题 | 解决方案 |
|---|---|
| 401 未授权 | 令牌需要 alerts:write 作用域 |
| 403 禁止访问 | 令牌必须属于目标组织 |
| 404 未找到 | 检查组织标识符和区域(us 与 de) |
| 400 错误请求 | 验证负载 JSON 结构,检查必填字段 |
| 用户 ID 未找到 | 验证邮箱是否匹配组织的成员 |
每周安装数
185
仓库
GitHub 星标数
19
首次出现
2026年2月18日
安全审计
安装于
codex183
gemini-cli182
opencode182
github-copilot180
amp179
kimi-cli179
Create alerts via Sentry's workflow engine API.
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.
curl available in shellalerts:write scope (also accepts org:admin or org:write)Ask the user for any missing details:
| Detail | Required | Example |
|---|---|---|
| Org slug | Yes | sentry, my-org |
| Auth token | Yes | sntryu_... (needs alerts:write scope) |
| Region | Yes (default: us) | us → us.sentry.io, de → de.sentry.io |
Use these API calls to resolve names to IDs as needed.
API="https://{region}.sentry.io/api/0/organizations/{org}"
AUTH="Authorization: Bearer {token}"
# Find user ID by email
curl -s "$API/members/" -H "$AUTH" | python3 -c "
import json,sys
for m in json.load(sys.stdin):
if m.get('email')=='USER_EMAIL' or m.get('user',{}).get('email')=='USER_EMAIL':
print(m['user']['id']); break"
# List teams
curl -s "$API/teams/" -H "$AUTH" | python3 -c "
import json,sys
for t in json.load(sys.stdin):
print(t['id'], t['slug'])"
# List integrations (for Slack/PagerDuty)
curl -s "$API/integrations/" -H "$AUTH" | python3 -c "
import json,sys
for i in json.load(sys.stdin):
print(i['id'], i['provider']['key'], i['name'])"
Pick which issue events fire the workflow. Use logicType: "any-short" (triggers must always use this).
| Type | Fires when |
|---|---|
first_seen_event | New issue created |
regression_event | Resolved issue recurs |
reappeared_event | Archived issue reappears |
issue_resolved_trigger | Issue is resolved |
Conditions that must pass before actions execute. Use logicType: "all", "any-short", or "none".
Thecomparison field is polymorphic — its shape depends on the condition type:
| Type | comparison format | Description |
|---|---|---|
issue_priority_greater_or_equal | 75 (bare integer) | Priority >= Low(25)/Medium(50)/High(75) |
issue_priority_deescalating | true (bare boolean) | Priority dropped below peak |
event_frequency_count | {"value": 100, "interval": "1hr"} |
Interval options: "1min", "5min", "15min", "1hr", "1d", "1w", "30d"
Tag match types: "co" (contains), "nc" (not contains), "eq", "ne", "sw" (starts with), "ew" (ends with), "is" (set), "ns" (not set)
Set conditionResult to false to invert (fire when condition is NOT met).
| Type | Key Config |
|---|---|
email | config.targetType: "user" / "team" / "issue_owners", config.targetIdentifier: <id> |
slack | integrationId: , : |
{
"name": "<Alert Name>",
"enabled": true,
"environment": null,
"config": { "frequency": 30 },
"triggers": {
"logicType": "any-short",
"conditions": [
{ "type": "first_seen_event", "comparison": true, "conditionResult": true }
],
"actions": []
},
"actionFilters": [{
"logicType": "all",
"conditions": [
{ "type": "issue_priority_greater_or_equal", "comparison": 75, "conditionResult": true },
{ "type": "event_frequency_count", "comparison": {"value": 50, "interval": "1hr"}, "conditionResult": true }
],
"actions": [{
"type": "email",
"integrationId": null,
"data": {},
"config": {
"targetType": "user",
"targetIdentifier": "<user_id>",
"targetDisplay": null
},
"status": "active"
}]
}]
}
frequency: minutes between repeated notifications. Allowed values: 0, 5, 10, 30, 60, 180, 720, 1440.
Structure note: triggers.actions is always [] — actions live inside actionFilters[].actions.
curl -s -w "\n%{http_code}" -X POST \
"https://{region}.sentry.io/api/0/organizations/{org}/workflows/" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{payload}'
Expect HTTP 201. The response contains the workflow id.
Confirm the alert was created and provide the UI link:
https://{org_slug}.sentry.io/monitors/alerts/{workflow_id}/
If the org lacks the workflow-engine-ui feature flag, the alert appears at:
https://{org_slug}.sentry.io/alerts/rules/
# List all workflows
curl -s "$API/workflows/" -H "$AUTH"
# Get one workflow
curl -s "$API/workflows/{id}/" -H "$AUTH"
# Update a workflow
curl -s -X PUT "$API/workflows/{id}/" -H "$AUTH" -H "Content-Type: application/json" -d '{payload}'
# Delete a workflow
curl -s -X DELETE "$API/workflows/{id}/" -H "$AUTH"
# Expect 204
| Issue | Solution |
|---|---|
| 401 Unauthorized | Token needs alerts:write scope |
| 403 Forbidden | Token must belong to the target org |
| 404 Not Found | Check org slug and region (us vs de) |
| 400 Bad Request | Validate payload JSON structure, check required fields |
| User ID not found | Verify email matches a member of the org |
Weekly Installs
185
Repository
GitHub Stars
19
First Seen
Feb 18, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykFail
Installed on
codex183
gemini-cli182
opencode182
github-copilot180
amp179
kimi-cli179
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
119,800 周安装
Fastmail SMTP 集成教程:使用 Python 脚本通过 Fastmail 发送电子邮件
1 周安装
Agent Skills (agentskills.io) - 为AI智能体创建可移植技能的规范与工具
1 周安装
CI/CD流水线设置指南:自动化构建、测试与部署最佳实践
173 周安装
shadcn/ui 组件库使用指南:Radix UI + Tailwind CSS 可自定义前端组件集成
1 周安装
Web性能优化专家模式 | 核心Web指标、页面加载速度与渲染性能优化工具
1 周安装
API安全审查指南:OWASP API十大风险检测与自动化测试工具
1 周安装
| Alert name | Yes | "High Priority De-escalation Alert" |
| Trigger events | Yes | Which issue events fire the workflow |
| Conditions | Optional | Filter conditions before actions execute |
| Action type | Yes | email, slack, or pagerduty |
| Action target | Yes | User email, team, channel, or service |
| Event count in time window |
event_unique_user_frequency_count | {"value": 50, "interval": "1hr"} | Affected users in time window |
tagged_event | {"key": "level", "match": "eq", "value": "error"} | Event tag matches |
assigned_to | {"targetType": "Member", "targetIdentifier": 123} | Issue assigned to target |
level | {"level": 40, "match": "gte"} | Event level (fatal=50, error=40, warning=30) |
age_comparison | {"time": "hour", "value": 24, "comparisonType": "older"} | Issue age |
issue_category | {"value": 1} | Category (1=Error, 6=Feedback) |
issue_occurrences | {"value": 100} | Total occurrence count |
<id>config.targetDisplay"#channel-name"pagerduty | integrationId: <id>, config.targetDisplay: <service_name>, data.priority: "critical" |
discord | integrationId: <id>, data.tags: tag list |
msteams | integrationId: <id>, config.targetDisplay: <channel> |
opsgenie | integrationId: <id>, data.priority: "P1"-"P5" |
jira | integrationId: <id>, data: project/issue config |
github | integrationId: <id>, data: repo/issue config |