Retries and health
#What counts as success
Any 2xx status within 10 seconds. Everything else is a failure: a timeout, a connection error, a status of 3xx, 4xx or 5xx. Redirects are never followed, so a 3xx answer is a failure.
- 410 Gone disables the endpoint at once. Use it if you want SmartChat to stop.
- On 429 and 5xx SmartChat respects the
Retry-Afterheader (at most 24 hours).
#Retry schedule
A failed delivery is tried again. There are up to 9 attempts, and no later than 72 hours after the event (the last attempt is moved forward to that point). A random change of up to 20 percent is added to each wait so that many deliveries do not arrive at the same moment. The header SmartChat-Delivery-Attempt tells you which attempt you got.
| Attempt | Wait before the attempt |
|---|---|
| 1 | immediately |
| 2 | 30 seconds |
| 3 | 2 minutes |
| 4 | 10 minutes |
| 5 | 1 hour |
| 6 | 4 hours |
| 7 | 12 hours |
| 8 | 1 day |
| 9 | 2 days |
After the last attempt the delivery is failed. Failed deliveries stay in the delivery log for 30 days. You can send them again by hand.
#Health of an endpoint
An endpoint is never switched off after a single failed delivery.
| State | What it means | How it changes |
|---|---|---|
active | Receives events. | 5 failed attempts in a row: degraded. |
degraded | Still receives events. The state is shown in the app and in the endpoint (status). SmartChat does not send a warning mail yet, so check the status from time to time. | A success: active. At least 3 days without a success and at least 20 attempts in a row: paused. |
paused | Receives no events. Deliveries that are waiting when the endpoint is paused fail with endpoint_paused and are not sent later by themselves. | 7 days without a success: disabled. The enable call makes it active again. |
disabled | Receives no events. | A 410 answer disables an endpoint at once. The enable call makes it active again. |
The test call does not change the health of an endpoint.
Events in a pause come back only by replay. While an endpoint is paused or disabled, its events are not queued for it and waiting deliveries are marked failed. When you turn it on again, send replay_since in the enable call (the time of your last good delivery, at most 7 days back and 10,000 events), or call replay afterwards. Without a replay, those events are lost for this endpoint.
#Get missed events back
- Send one delivery again: the redeliver call on a delivery.
- Turn an endpoint on again: the enable call (for
pausedanddisabledendpoints). You can ask it to replay events from a time in the same call. - Replay events: the replay call sends events of a time range again (at most 7 days back and 10,000 events; it needs an
Idempotency-Key).
All calls are in Webhook endpoints API.