Webhook best practices
The following best practices will enhance your app's ability to handle webhook requests with greater robustness.
Simplying webhook processing
We recommend simplifying the processing of webhooks. This is crucial to avoid overloading your server, especially when processing many webhooks at once. Heavy processing will also result in slower response times, which could exceed the required response time and cause webhook failures.
A viable solution is to process webhooks asynchronously, ensuring a "200 OK" response within the time limit while handling more complex processing separately.
Implement event reconciliation
As webhook notifications are not guaranteed, we recommend implementing reconciliation process for data accuracy. It can be done via a long-polling mechanism to periodically fetch data from the API. This approach mitigates the risk of webhook undelivery or delays. By incorporating both webhook and API long-polling implementations, your app can achieve optimal stability and robustness.