Genesys v2.analytics.conversation.aggregate JSON nesting depth

Parsing the payload from a v2.analytics.conversation.aggregate webhook is proving tricky. The metrics array nests objects under group and time_bucket which shifts depending on the query granularity. My current JSON path logic breaks when time_bucket is absent. Anyone have a reliable way to flatten this without hardcoding the structure?

Check your groupBy config. If you omit time_bucket, the payload structure changes entirely. Don’t parse it manually. Use a JSONata map to flatten the metrics array regardless of depth.

$.metrics[*]{
 "group": group,
 "value": metrics[? name = 'talk']
}

Handles missing buckets cleanly.