We’re building a custom agent desktop extension using the Genesys Cloud Client App SDK. We need to react to specific interaction events, so we set up an EventBridge rule to send these events to our custom microservice endpoint. The integration works, but we are seeing a massive amount of duplicate events hitting our server. Sometimes the exact same detail-type and source come in three or four times within a second.
I’ve tried adding a simple in-memory cache to deduplicate based on the event ID, but the high volume is causing memory issues and some legitimate distinct events are getting dropped because the cache key collision logic is too aggressive. Here is the basic handler we are using in Node.js:
app.post('/event-bridge', (req, res) => {
const event = req.body;
const eventId = event.id;
// Simple check
if (processedIds.has(eventId)) {
console.log('Duplicate detected, ignoring');
return res.status(200).send('Ignored');
}
processedIds.add(eventId);
processEvent(event);
res.status(200).send('OK');
});
The problem is that processedIds is just a Set in memory. If the service restarts, the cache is gone. Also, if two slightly different events have similar metadata, I’m worried about false positives. We need a more solid way to handle this without spinning up a full Redis instance just for deduplication if possible.
Is there a standard pattern for handling this in the SDK context? Or should we be looking at the time field in the EventBridge payload to create a composite key? The events look like this:
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"detail-type": "Interaction Created",
"source": "genesys.cloud",
"account": "123456",
"time": "2023-10-27T10:00:00Z",
"detail": {
"interactionId": "xyz-123",
"channel": "voice"
}
}
We’re seeing these duplicates even when the time is identical. It feels like EventBridge is retrying because our service is taking too long to respond, but we are returning 200 immediately. What am I missing in the handshake?