API and integration

Incoming webhooks

Sending data into the system from outside.

There are three incoming endpoints; each is protected by its own token and created separately.

EndpointForWhere the token comes from
/api/duty/incidents/{token}Monitoring alert → incidentDuty → rotation → Integration
/api/chat/hook/{token}External notification → chat messageChannel → Webhooks
/api/chat/hook/{token}/taskExternal event → taskThe 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.