Deduplicate repeated alerts with a dedup keyCollapse repeated alerts

A flapping service reports the same problem again and again. Each report is a new event, so an Idempotency-Key won't catch it. Name the condition with a dedupKey instead.

curl
curl https://acciti.com/v1/messages \  -H "Authorization: Bearer $ACCITI_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "user": "your-user-key",    "message": "api.acme.com is not responding",    "dedupKey": "api-acme-down",    "dedupWindow": 600  }'

The first send alerts. Repeats inside the window collapse into it and raise its count without ringing, and the response says "status": "collapsed" with that alert's ID. The window runs from the first alert, so a service flapping every second rings once per window. The window defaults to 5 minutes, with a maximum of a day. Acknowledging closes the key, so the next occurrence alerts again.

Without a key

Recipients can also merge alerts with the same title and body from the same sender inside the window. It's on unless they turn it off, so handle "status": "collapsed" even if you never send a key. A key still works better where you have one: only you know that "disk at 91%" and "disk at 94%" are the same condition.

Storm protection

Fifty different alerts in five minutes are not repeats, and collapsing them would lose them. Past ten from one sender to one person within five minutes, the rest still arrive but make no sound. The response carries "silenced": "storm".

Emergencies are never silenced by storm protection.