DEV Community

Monitoring Third-Party Webhook Delays with AWS Durable Functions

In this blog, I'll explain how did we use Durable functions to monitor if delays occurs with the reception of third party webhooks.

When integrating with external third-party services, webhook notifications don't always arrive immediately or at all.

We needed visibility into:

  • Whether webhooks actually arrive
  • How long they take to reach our system

The idea was simple:

  1. API GW -> Lambda function which makes a request to third party, start a Durable Function by sending an event to Eventbridge, and returns the sync response to the user because the client needed a synchronous response.

2.
Durable Function starts, generate a callbackId, stores the Callback in DynamoDB and waits until a callback is completed. This durable function will allow us to know if the webhook notification ever arrived and if it does how long did it take to land in our system.

3.
API GW-> SQS -> Webhook handler Lambda. This webhook handler consumes the Webhook notification from the third party and, gets the callbackId associated and resumes the Durable Function execution.
Having SQS prevent us from having from the race condition scenario where a webhook Notification arrives before the Durable Function has not started.

We monitor everything with AWS X-Ray and you can create Cloudwatch Dashboards to monitor how long does it take to arrive on average your notification.

Thank you so much for the reading.

Top comments (0)