EventBridge duplicates for routing.queue.member.added — deduplication strategy?

Hey folks,

We’ve been integrating Genesys Cloud EventBridge with a custom consumer service (Node.js on Lambda) to handle real-time updates for our agent desktop extension. Specifically, we are listening to routing.queue.member.added events.

The problem is that we are seeing duplicate events arrive within milliseconds of each other for the same action. I checked the EventBridge console and the Genesys side, but nothing obvious stands out as a misconfiguration on the rule itself. It seems like a race condition or retry logic on the Genesys side.

Here is a sample of the event payload we are receiving:

{
 "id": "evt-1234567890abcdef",
 "timestamp": "2023-10-27T18:45:12.005Z",
 "source": "genesys.cloud",
 "detail": {
 "id": "member-id-xyz",
 "queueId": "queue-id-abc",
 "member": {
 "id": "agent-id-123",
 "name": "John Doe"
 }
 }
}

I noticed the id field in the root of the event is different for each duplicate, even though the detail.id (the member ID) is the same. This makes simple deduplication based on the event ID tricky if I just store IDs in a Redis cache, because I don’t know which one is the “real” one and which is the retry.

My current workaround is to check the detail.id against a local database and only process if the record doesn’t exist or if the timestamp is newer. But this feels hacky. Is there a standard way to handle this in the SDK or via API? Should I be ignoring duplicates based on a time window, or is there a unique correlation ID I’m missing?

Any code examples for a solid deduplication pattern in a serverless environment would be appreciated. I don’t want to miss any real events, but processing duplicates is causing issues with our state management.