Trying to build a report that links CSAT survey scores back to the specific voice interaction IDs. The goal is to see which agents got low scores on calls where the call duration was under 30 seconds.
I’m using the Analytics API to pull the survey data. The endpoint is POST /api/v2/analytics/surveys/aggregates/query. I have the survey ID and I’m filtering by the completion date range.
Here is the query body I’m sending:
{
"query": {
"filter": {
"field": "surveyId",
"operator": "equals",
"values": ["12345678-abcd-1234-abcd-1234567890ab"]
},
"range": {
"field": "completedAt",
"from": "2023-10-01T00:00:00Z",
"to": "2023-10-31T23:59:59Z"
}
},
"groupBy": [],
"aggregations": [],
"sorts": [],
"size": 100
}
The response comes back with 200 OK. The data array has 500 entries. Each entry has a surveyId, completedAt, and overallRating. But there is no interactionId or conversationId field in the response object. I need that ID to join this data with the conversation analytics.
I checked the API docs for the survey aggregates query. It implies the response can include conversation details. My response does not.
I tried adding conversationId to the groupBy array. The API returned 400 Bad Request with "message": "Field 'conversationId' is not a valid groupBy field for this resource type."
Is there a different endpoint? Or do I need to use the surveyResponseId to look up the interaction in a separate call? I have the surveyResponseId in the response. Maybe I can use that to get the survey details for a specific conversation?
Tried that. I used GET /api/v2/quality/conversations/{conversationId}/surveys but I don’t have the conversation ID to start with, which is the whole problem.
Anyone know how to get the interaction ID directly in the bulk query?