The first step to adding webhooks to your Verkada integration is to build your own custom endpoint. Creating a webhook endpoint on your server is no different from creating any page on your website.
Before looking at the code, there are several key considerations regardless of the technology involved. You should also review the best practices for using webhooks.
For each event occurrence, Verkada POSTs the webhook data to your endpoint in JSON format. The full event details are included and can be used directly after parsing the JSON into an Event object. Thus, at minimum, the webhook endpoint needs to expect data through a POST request and confirm the successful receipt of that data.
Return a 2xx status code quickly
To acknowledge receipt of an event, your endpoint must return a 2xx HTTP status code to Verkada. If Verkada does not receive a 2xx HTTP status code, the webhook notification attempt is repeated immediately.
Because properly acknowledging receipt of the webhook notification is so important, your endpoint should return a 2xx HTTP status code prior to any complex logic that could cause a timeout.
You have 2 seconds to respond to a notification. If you don't send a response inside that time, the notification is treated as failed and will be retried only once.