Trying to extract the duration from a v2.analytics.conversation.aggregate event in EventBridge. The payload is deeply nested.
{
"detail": {
"data": {
"items": [
{
"metrics": {
"duration": 12000
}
}
]
}
}
}
My current JSON path $.detail.data.items[0].metrics.duration returns null. Am I missing a step in the mapping or is the structure different in production?
that path looks solid on paper, but EventBridge payloads can be tricky depending on how the event was captured. are you sure it’s a standard aggregate event and not a queued or archived variant? the structure shifts slightly between them.
also, check if the items array is actually populated. sometimes you get an empty array [] if the filter didn’t match anything, which would definitely return null.
try this quick curl to inspect a recent failed delivery or a DLQ item if you have it enabled:
curl -X GET "https://api.mypurecloud.com/api/v2/analytics/conversations/queues/queueId/summary" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json"
if the payload is consistent, your path $.detail.data.items[0].metrics.duration should work. if it’s still null, print the raw detail.data.items to see what’s actually in there. might be a timestamp issue or a different metric name like tHandle.