Genesys webhook 502s and dead letter strategy

Our Node endpoint is timing out on large batch events, causing Genesys to return 502 Bad Gateway. We’ve got a basic retry loop in place, but it’s just hammering the same broken path. Looking for a quick way to push these failures to an SQS dead letter queue instead of blocking the thread. Any sample code for handling the webhook response status properly?