To receive webhook events, you will need to register your endpoint with us.
A webhook handler is responsible for receiving and processing the events sent from our system to your specified URL. This section will guide you through the steps needed to create a webhook handler using Node.js that can successfully receive, validate, and respond to our webhook events. This should be no different in any other framework or language.
API endpoints for registering and managing webhook endpoints coming soon
Start by setting up an endpoint in your Node.js application using a framework like Express to handle incoming POST requests. This endpoint will receive the webhook payload as an HTTP request, which will be in JSON format.
Ensure the endpoint responds with a 2xx HTTP status code if the payload is received and processed successfully. If there are any issues, return an appropriate error code (e.g., 400 for validation errors, 500 for server issues). If a non 2xx status code is returned, we will not retry the delivery of the event.
The webhook payload will contain relevant event data in JSON format. You will need to extract this data from the request body.
Example employee.created event payload:
For the example employee.created event:
evt_.Example (in Node.js)
Before processing the webhook, it is important to verify the authenticity of the request. This is done by validating the x-kota-webhook-signature header that accompanies the request. The header contains a timestamp and a signature, which you can use to confirm that the payload has not been tampered with.
The HTTP header looks like this:
It includes:
You can verify the signature by following these steps:
Here’s how to implement signature verification in Node.js:
This ensures that only requests from your trusted source are processed, protecting your application from tampered or spoofed payloads.
Webhook events are delivered instantly upon trigger. If your system responds with a successful 2xx status code, no further retries will be made.
However, if the event is not acknowledged, retries will follow based on a backoff schedule.
A successful delivery occurs when your webhook endpoint returns any 2xx HTTP status code. This confirms that the event was received and processed correctly.
Upon receiving a successful response, no retries will be attempted for that event.
In the event that a webhook cannot be delivered successfully (i.e., your endpoint does not return a 2xx HTTP status code), our system will retry the delivery according to an exponential backoff strategy in 9 attempts over 3 days.
The retries are spread out over a period of time to accommodate temporary issues such as network disruptions or service downtime on your end. Additionally, a random jitter of ±15 seconds is applied to each retry to prevent simultaneous retries from overloading your server.
The retry process will stop if your endpoint returns a 2xx status at any point, indicating successful delivery. If the event is not acknowledged after the final attempt, no further retries will be made.
If the final retry attempt fails, we will notify you via email to alert you of the undelivered event. You should manually process these events within 30 days of the initial event trigger to ensure no data loss.
Webhook events are delivered as soon as they occur but we do not guarantee their delivery in a strict chronological order. Ensure your system can handle events arriving out of sequence by using timestamps or unique IDs to process them correctly.
Our API currently uses version 1.0, which is specified in both the API and webhook payloads. Each webhook event includes the api_version field, which is set to “1.0”. This ensures that the data format and behavior you receive aligns with version 1.0 of our API.
Example webhook payload:
To ensure compatibility, we recommend monitoring our announcements and documentation for new versions and their features. Ensure that your system calls the API with the correct version based on the version of the webhook you are using. The version of the webhook is also the version of the API that the webhook is using.
To ensure secure and reliable handling of webhook events, follow these best practices:
2xx response within a few seconds to avoid unnecessary retries.