Hey folks, trying to build a custom dashboard widget that shows real-time Service Level (SL) for a specific queue. I’m hitting GET /api/v2/analytics/queues/summary with intervalType=realtime and grouping=none. The response gives me offerCount, answerCount, answeredWithinSLCount, etc., but the math isn’t adding up when I try to calculate the percentage myself.
Here’s the snippet I’m using in Python:
import requests
headers = {'Authorization': 'Bearer <token>', 'Content-Type': 'application/json'}
params = {
'intervalType': 'realtime',
'grouping': 'none',
'queues.id': '12345678-1234-1234-1234-123456789012'
}
response = requests.get('https://api.mypurecloud.com/api/v2/analytics/queues/summary', headers=headers, params=params)
data = response.json()
for item in data['entities']:
offered = item['offerCount']
answered = item['answerCount']
answered_in_sl = item['answeredWithinSLCount']
if offered > 0:
sl_pct = (answered_in_sl / offered) * 100
else:
sl_pct = 0
print(f"SL: {sl_pct}%")
The issue is that answeredWithinSLCount seems to include answers that happened after the SL threshold but before the agent actually picked up? Or maybe it’s counting something else entirely. When I compare this to the Genesys UI widget, the numbers are off by about 5-10%. The UI shows 85% SL, but my script is calculating 92%.
I’ve checked the docs and it says answeredWithinSLCount is the number of interactions answered within the service level threshold. But what if the interaction was offered, then abandoned, then re-offered and answered within SL? Does that count once or twice? Also, does offerCount include offers that were never answered at all?
I need to know the exact formula Genesys uses so I can match it. Any pointers on how to handle abandoned calls in the SL calculation? Or is there a different field I should be looking at?