Now that you've created your first Webhook, it's essential to configure your server to accept incoming webhook requests. Below, we provide a minimal example server that demonstrates how to set up a route to handle webhooks. In this example, we configure the server to accept webhooks on the /chariot/webhooks route. However, you may need to adapt the code snippet based on your specific server framework or requirements:

const app = require('express')();'/chariot/webhooks', (req, res) => {
  console.log("RECEIVED WEBHOOK", req.body)

const port = process.env.PORT || '8002';
app.listen(port, () => {
  console.log('Server running on port ' + port + '. Now open http://localhost:' + port + '/ in your browser!');

In the code snippet above, the /chariot/webhooks route is configured as a POST endpoint, allowing the server to receive webhook payloads. Inside the route handler, you can access the received payload from req.body and process it accordingly.

To prevent re-delivery of webhook payloads, it is essential to respond with a 200-level status code within a short timeframe. This response should be sent before any processing takes place. By doing so, you ensure that the webhook provider is notified of the successful receipt of the payload. It is recommended to handle the response synchronously, immediately acknowledging the webhook, and then proceed with further processing asynchronously. This approach allows your server to continue processing the payload and performing necessary actions without delaying the response. It's important to note that if your server responds with a 300+ level status code, Chariot will attempt to resend the webhook until it receives a successful response. See the Retry Schedule page for more information on how often retries happen.

Make sure to adapt the server configuration and route based on your server environment and requirements to ensure seamless integration and handling of incoming webhook requests.