We are trying to build a custom interval report for our agent desktop extension. The goal is to show agents their average handle time broken down by skill group in real time. We have been using the Embeddable Client App SDK for the UI, but we need to pull the data from the Analytics API directly.
The endpoint is POST /api/v2/analytics/conversations/aggregates. We constructed the JSON payload based on the documentation. It looks like this:
{
"dateFrom": "2023-10-01T00:00:00.000Z",
"dateTo": "2023-10-01T23:59:59.999Z",
"groupBy": ["wrapUpCode", "skill"],
"metrics": ["handled", "talk"],
"interval": "PT1H"
}
When we send this request, we get a 400 Bad Request. The error message says Invalid groupBy value: skill. This is confusing because skill is listed as a valid dimension in the schema for conversation aggregates. We tried using skillId instead, but that also failed with the same error.
We checked the OAuth token. It has the analytics:report:view scope. The token works fine for other endpoints like getting user details. We also verified the date range. It is valid and within the last 30 days.
The documentation says that some dimensions require specific filters. We tried adding a filter for conversationType equal to voice. The request still fails. We are using the JavaScript SDK to make the call. The code looks like this:
const response = await platformClient.analytics.postAnalyticsConversationsAggregates(payload);
The error occurs before we even get a response object. It throws a validation error. We are stuck on this for two days. The team needs this report for the next sprint review. We don’t understand why skill is invalid. Is there a specific format required for the groupBy array? Or is the skill dimension only available for certain report types? We tried looking at the Swagger UI example. It shows queue as a groupBy value. That works fine. But skill does not.
We also noticed that the wrapUpCode dimension works when used alone. So the issue seems to be with combining wrapUpCode and skill. Or maybe skill itself is not supported in this specific endpoint version. We are using the latest version of the SDK.
Any ideas on what we are missing? The error message is not very helpful. It just says invalid value. We need to know the correct syntax. We have tried every combination we can think of. The documentation is not clear on the dependencies between dimensions. We are going to try removing the interval field next. But that seems unrelated.
We are running out of options here. The deadline is tomorrow. We need this working. Please help.