I’m trying to build a real-time dashboard that shows the current queue state (waiting calls, agents available) for a specific routing queue in Genesys Cloud. I figured the Statistics API is the way to go, specifically the GET /api/v2/analytics/queue/realtime endpoint.
I’m using the Python SDK (genesyscloud package) to make the call. Here’s the snippet I’m working with:
from purecloudplatformclientv2 import AnalyticsApi, QueueRealtimeQuery
analytics_api = AnalyticsApi(configuration)
query = QueueRealtimeQuery(
entity_id="my-queue-id-here",
interval="2023-10-27T15:00:00.000Z/2023-10-27T15:05:00.000Z",
group_by="queue"
)
try:
result = analytics_api.post_analytics_queue_realtime(query=query)
print(result)
except Exception as e:
print(f"Error: {e}")
The issue is that the response comes back, but the entities list is completely empty. I’m not getting any HTTP errors, just an empty result set. I’ve double-checked that the entity_id is correct and that there are actually calls waiting in that queue right now (I can see them in the admin UI).
Is there a specific permission I’m missing on the API user? Or am I constructing the QueueRealtimeQuery object wrong? The docs mention interval, but for “realtime” data, does the interval even matter, or should I be using a different endpoint like /api/v2/queue/metrics?
Any pointers on how to get that live count data would be great.