I’m trying to calculate Service Level % for our support queue using the real-time analytics API. The dashboard shows 92% SLA, but my script keeps returning 85%. I’m using the GET /api/v2/analytics/queues/realtime endpoint with the groupBy parameter set to queue.
Here is the relevant part of the JSON response I’m parsing:
{
"groups": [
{
"key": {
"id": "abc-123-def"
},
"values": {
"queue": {
"id": "abc-123-def",
"name": "Support"
}
},
"metrics": {
"offeredCount": 100,
"answeredCount": 90,
"answerTime": {
"mean": 12.5,
"percentile90": 18.0
},
"waitTime": {
"mean": 8.2,
"percentile90": 15.0
}
}
}
]
}
I assumed SLA is just answeredCount / offeredCount. That gives me 90%. But the dashboard says 92%. The docs mention serviceLevelPercentile but I don’t see that field in the real-time metrics object. Am I missing a specific metric? Or is the dashboard calculating it differently based on the 20-second threshold? I’ve tried using percentile90 from waitTime but that doesn’t seem right either. Just need to get the numbers to match for my adherence report. I’m in US/Central so maybe there’s a timezone offset issue with the interval data? No, this is real-time. Any code examples for the correct formula would be great. I don’t want to guess.