Hey everyone,
I’m running into a nasty issue with our WEM adherence webhook consumer. We have a simple Node.js service listening for routing.queueMemberAdded events to track real-time adherence, but if our app crashes or returns a 500 Internal Server Error, Genesys Cloud seems to just give up on that event after a few retries. I need to know how to set up a proper dead letter queue or retry mechanism because losing adherence data is a nightmare for my reports.
Here is the setup:
- Endpoint:
https://wfm-internal.example.com/webhooks/genesys-events - Framework: Express.js (Node 18)
- Error: Genesys sends the event, my server throws an unhandled exception (simulating a crash), returns 500. Genesys retries 3 times with exponential backoff. On the 4th attempt, the event is dropped. No DLQ.
- Goal: I want failed events to go to an SQS queue or S3 bucket so I can process them later, rather than losing them.
I’ve checked the Webhook configuration in the Admin console under Integrations > Webhooks. There’s no obvious setting for “Dead Letter Queue” or “S3 Backup” like there is for some other AWS integrations. I thought maybe I could handle this in the code by catching the 500 and pushing to SQS, but if the whole process crashes, the code never runs.
Is there a way to configure Genesys to persist failed webhook deliveries? Or is the only way to make my endpoint idempotent and return 200 immediately, then process the payload asynchronously? If I return 200 immediately, I’m afraid of race conditions if the event fires twice during a retry window.
Here’s the basic handler I’m using:
app.post('/webhooks/genesys-events', (req, res) => {
try {
const event = req.body;
// Simulate a crash
if (event.type === 'routing.queueMemberAdded') {
throw new Error('Database connection timeout');
}
res.status(200).send('OK');
} catch (err) {
console.error(err);
res.status(500).send('Error');
}
});