There are three incoming endpoints; each is protected by its own token and created separately.
| Endpoint | For | Where the token comes from |
|---|---|---|
/api/duty/incidents/{token} | Monitoring alert → incident | Duty → rotation → Integration |
/api/chat/hook/{token} | External notification → chat message | Channel → Webhooks |
/api/chat/hook/{token}/task | External event → task | The same channel webhook |
The incident endpoint
It accepts two formats: the Prometheus Alertmanager / Grafana body (with an alerts[] array) and a simple flat JSON:
curl -X POST https://taskfly.az/api/duty/incidents/TOKEN \
-H 'Content-Type: application/json' \
-d '{
"action": "trigger",
"dedupKey": "cpu-web-01",
"title": "web-01 CPU 95%",
"severity": "critical",
"details": "CPU has been above 95% for five minutes"
}'To close it, send "action": "resolve" with the same dedupKey. The call is idempotent: it returns 200 even when there is no open incident.