Hey everyone,
I’m trying to calculate the real-time Service Level percentage for a specific queue using the Analytics API. I’ve been pulling data from GET /api/v2/analytics/queues/realtime/intervals and trying to do the math in Python.
The interval data gives me offered and answered counts, but I also need the time-to-answer to determine if a call was answered within the 20-second threshold. The interval object has a start and end timestamp, but it doesn’t seem to have a breakdown of how many of those answered calls actually met the service level target within that specific bucket.
Here’s the snippet I’m working with:
response = api_instance.get_analytics_queues_realtime_intervals(
interval='PT5M',
group_by='queue/id',
view='queue',
select='offered,answered,abandoned'
)
for interval in response.entities:
total_offered = interval.accumulated.offered
total_answered = interval.accumulated.answered
# How do I filter for answered < 20s?
The accumulated object just gives me totals. If I look at the interval object instead, the numbers are too granular and I can’t seem to sum them up correctly for the last 15 minutes without missing some edge cases where a call spans two intervals.
Is there a specific field I’m missing in the interval payload that tells me the count of calls answered within the threshold? Or do I need to switch to the GET /api/v2/analytics/queues/summary endpoint and parse the percentAnswered field differently?
The current approach feels hacky because I’m trying to reverse-engineer the percentage from raw counts that don’t explicitly state their adherence to the SLA target.