I've created 2 Call Data Actions to address this, 1 is safer but doesn't give much details, the other gives more detail but may get deprecated too...
Safer Method - using the /api/v2/routing/queues/{queueId}/members API, filtering by On Queue presence, this works in a similar way to retrieving the "total": value when it was /user, "total" as the total is just the total elements/objects in the returned "entities" array, it's what SethAtGenesys is refering to, now you are just doing your own count of how many elements/objects in that array. Config below.
Request:
{
"requestUrlTemplate": "/api/v2/routing/queues/{input.QUEUE_ID}/members?joined=true&presence=On%20Queue",
"requestType": "GET",
"headers": {
"UserAgent": "PureCloudIntegrations/1.0",
"Content-Type": "application/x-www-form-urlencoded"
},
"requestTemplate": "{input.rawRequest}"
}
Response:
{
"translationMap": {
"OnQueueAgentCount": ".entities.size()"
},
"translationMapDefaults": {
"OnQueueAgentCount": "0"
},
"successTemplate": "{\"OnQueueAgentCount\": {OnQueueAgentCount}}"
}
More detailed way but not as safe (API can break) - using the /api/v2/analytics/queues/observations/query API
You are retrieving some metrics for the queue, I use the “oActiveUsers” and “oUserRoutingStatuses”, you need to be careful though because if no agents are Activated on the queue (a member but deactivated by supervisor or themselves) then no “oUserRoutingStatuses” will be returned and if that is the only metric you are retrieving there will be no “Data” array and the Call Data Action will fail (depending how you write it). I included the “oActiveUsers” metric because it’s a constant, even if no agents are Activated on queue it will still show and return 0, the risk is that if Genesys changes the behavior of "oActiveUsers" to the same as “oUserRoutingStatuses” (not show if not used / 0) then the below Call Data Action will fail as the "data" array will not generate.
Running the API in Developer site as the below,
{
"filter": {
"type": "or",
"clauses": [
{
"type": "or",
"predicates": [
{
"type": "dimension",
"dimension": "queueId",
"operator": "matches",
"value": "ab1bfbda-34c1-4931-a108-56381a30769a"
}
]
}
]
},
"metrics": ["oActiveUsers","oUserRoutingStatuses"]
}
Will return
{
"results": [
{
"group": {
"queueId": "ab1bfbda-34c1-4931-a108-56381a30769a"
},
"data": [
{
"metric": "oActiveUsers",
"stats": {
"count": 3
}
},
{
"metric": "oUserRoutingStatuses",
"qualifier": "OFF_QUEUE",
"stats": {
"count": 3
}
}
]
}
]
}
Call Data Action config is as follows, this allows for 0 values and works if "metric": "oUserRoutingStatuses" doesn’t exist.
Request
{
"requestUrlTemplate": "/api/v2/analytics/queues/observations/query",
"requestType": "POST",
"headers": {},
"requestTemplate": "{"filter": {"type":"or","predicates": [{"dimension": "queueId","value": "${input.QUEUE_ID}"}]}, "metrics": ["oUserRoutingStatuses","oActiveUsers"]}"
}
Response:
{
"translationMap": {
"offqueue": ".results[0].data[?(@.qualifier==\"OFF_QUEUE\")].stats.count",
"activeUsers": ".results[0].data[?(@.metric=="oActiveUsers")].stats.count",
"idle": ".results[0].data[?(@.qualifier==\"IDLE\")].stats.count",
"interacting": ".results[0].data[?(@.qualifier=="INTERACTING")].stats.count"
},
"translationMapDefaults": {
"offqueue": "0",
"activeUsers": "0",
"idle": "0",
"interacting": "0"
},
"successTemplate": "{"activeUsers": {successTemplateUtils.firstFromArray(\"{activeUsers}", "0")},"interacting": {successTemplateUtils.firstFromArray(\"{interacting}", "0")},"idle": {successTemplateUtils.firstFromArray(\"{idle}", "0")},"offqueue": {successTemplateUtils.firstFromArray(\"{offqueue}", "0")}}"
}