Best Practices | Climes API
Webhooks provide an effective method to track the state of various actions done by your users at Climes and to take appropriate actions. Take a look at these best practices to ensure your webhooks remain secure and function seamlessly with your integration.
Delivery Attempts and Retries
Every event that receives a non-2xx response is considered an event delivery failure by Climes's system. If there is a delivery failure, we retry the delivery in Exponential Backoff Policy for 18 hours after event creation timestamp
There are total of 16 retries if the first attempt fails to deliver. In total there are 17 attempts to deliver the webhook.
Webhooks are delivered in near real-time and are asynchronous.
Please note that Climes considers any non-2xx response as an event delivery failure. Please make sure the API responds with 2xx when you successfully consume the event at your end.
Retry Attempts Timings
The below table shows the retry attempt's timing and when the next retry will be attempted from the time of first attempt. This also shows the total time elapsed from the first attempt.
Current Attempt | Next Retry in (seconds) | Total Time Elapsed (seconds) |
---|---|---|
1 | 61 | 61 |
2 | 76 | 137 |
3 | 141 | 278 |
4 | 316 | 594 |
5 | 685 | 1279 |
6 | 1356 | 2635 |
7 | 2461 | 5096 |
8 | 4156 | 9252 |
9 | 6621 | 15873 |
10 | 10060 | 25933 |
11 | 14701 | 40634 |
12 | 20796 | 61430 |
13 | 28621 | 90051 |
14 | 38476 | 128527 |
15 | 50685 | 179212 |
16 | 65596 | 244808 |
Event Handling
Correct handling of webhook events is crucial to ensuring your integration's business logic works as expected.
Handle Duplicate Events
There could be scenarios where your endpoint might receive the same webhook event multiple times. This is an expected behaviour based on the webhook design. In such a scenario, we recommend you to follow Idempotency.
You could be receiving the same events multiple times as Climes follows at-least-once delivery semantics. In this approach, if we do not receive a successful response from your server, we resend the webhook. There could be situations where your server accepts the event but fails to respond in 5 seconds. In such cases, the session is marked timeout. It is assumed that the webhook was not processed and is sent again.
Ensure you configure your server to handle or receive the same event details multiple times.