Parsing Genesys Cloud EventBridge payloads in Lambda handler

What is the standard approach to parse and validate the JSON structure of a Genesys Cloud event received via AWS EventBridge in a Node.js Lambda function? I am currently developing a custom integration that needs to react to specific interaction events, such as conversation:analyzed or interaction:completed, in real-time without polling. I have successfully configured the EventBridge rule in Genesys Cloud to send events to my AWS account, and I can see the events arriving in the Lambda trigger logs. However, the payload structure seems to differ slightly from the standard REST API responses I am used to handling in my Zapier custom actions.

The incoming event object contains a nested detail field, but I am struggling to reliably extract the interactionId and participantId across different event types. Some events seem to have these fields at the root of the detail object, while others nest them deeper under conversationData. Here is a sample snippet of the payload I am receiving:

{
 "id": "evt-12345",
 "source": "com.genesys.cloud",
 "detail-type": "Interaction Event",
 "detail": {
 "eventType": "conversation:analyzed",
 "interactionId": "abc-def-ghi",
 "conversationData": {
 "participants": [
 {
 "id": "user-123",
 "role": "agent"
 }
 ]
 }
 }
}

My current Lambda handler attempts to access event.detail.interactionId, but this fails for event types where the interaction ID is buried inside conversationData. I want to create a robust parser that can handle the polymorphic nature of these event payloads. Should I be using a generic utility function to traverse the detail object, or is there a documented schema for the EventBridge payload that I am missing? I want to avoid hardcoding paths for every possible event type. Any code examples or best practices for handling this variability in a serverless environment would be appreciated.