Hey folks,
I’m trying to build an aggregation query that groups by queue and media type using the Genesys Cloud Analytics API. The goal is to get a breakdown of interactions per queue, split by voice, chat, and email. I’ve got the basic structure working, but the response isn’t grouping correctly. It’s returning a flat list instead of nested groups.
Here’s the JSON payload I’m sending to /api/v2/analytics/interactions/queues/query:
{
"dateFrom": "2023-10-01T00:00:00.000Z",
"dateTo": "2023-10-31T23:59:59.999Z",
"groupBy": ["queueId", "mediaType"],
"filters": {
"mediaType": {
"type": "in",
"values": ["voice", "chat", "email"]
}
},
"select": [
{
"type": "count"
}
]
}
The API returns a 200 OK, but the results array doesn’t have the expected group structure. Each item has a queueId and mediaType, but they’re not aggregated properly. I’m expecting something like:
{
"queueId": "abc123",
"groups": [
{
"mediaType": "voice",
"count": 150
},
{
"mediaType": "chat",
"count": 75
}
]
}
Instead, I’m getting:
[
{
"queueId": "abc123",
"mediaType": "voice",
"count": 150
},
{
"queueId": "abc123",
"mediaType": "chat",
"count": 75
}
]
Is this a limitation of the API, or am I missing something in the query structure? I’ve tried adding groupBy as a nested array, but that just throws a 400 Bad Request. Any pointers would be appreciated.