We’re building a consumer for EventBridge events and hitting a wall with the v2.analytics.conversation.aggregate type. The payload structure is deeply nested, and I can’t figure out the correct path to extract the handle_time metric for a specific queue.
I’ve tried accessing detail.data.metrics[0].value, but that returns null. The JSON seems to wrap the actual metrics in a values array inside each metric object, which isn’t obvious from the docs.
Here’s a snippet of the payload I’m receiving:
{
"detail": {
"data": {
"metrics": [
{
"id": "handle_time",
"values": [
{
"value": 120.5
}
]
}
]
}
}
}
My current parsing logic looks like this:
const handleTime = event.detail.data.metrics.find(m => m.id === 'handle_time')?.value;
This returns undefined. I assume I need to dig into the values array, but I want to make sure I’m not missing a wrapper object or a specific field name change in the latest API version. Has anyone successfully mapped these aggregate metrics in a webhook consumer? What’s the reliable path to the actual numeric value?