Parsing v2.analytics.conversation.aggregate event payload in Node.js consumer

Running a webhook consumer for Genesys Cloud analytics events. Specifically v2.analytics.conversation.aggregate. The goal is to extract the metric values for acd.talk and acd.wait. The payload structure is deeply nested and the TypeScript definitions in the SDK don’t quite match the runtime JSON for aggregate events.

Here is a snippet of the incoming body:

{
 "eventType": "v2.analytics.conversation.aggregate",
 "data": {
 "aggregationType": "conversation",
 "metrics": {
 "acd.talk": {
 "type": "duration",
 "value": 120.5
 },
 "acd.wait": {
 "type": "duration",
 "value": 45.2
 }
 }
 }
}

Trying to map this to a local interface. The issue is data.metrics is a dictionary of objects, not a flat object. Accessing body.data.metrics['acd.talk'].value works but feels brittle since the metric keys aren’t typed. Is there a standard way to handle this dynamic key structure in the JS SDK or should I just write a custom mapper? The SDK types suggest a fixed schema which doesn’t align with the aggregate event reality.

Current approach throws type errors on the key access. Need a clean way to parse this without disabling strict null checks.