Original Message:
Sent: 03-16-2026 12:01
From: Mariusz Ziemiecki
Subject: In Queue Position before call enter the queue
@Alesson Santos thanks for a quick response
Based on your suggestions and finally developed similar DataAction
"name": "Get Number of Calls in Queue - Exported 2026-03-16 @ 16:54",
"integrationType": "purecloud-data-actions",
"actionType": "custom",
"config": {
"request": {
"requestUrlTemplate": "/api/v2/analytics/queues/observations/query",
"requestType": "POST",
"headers": {},
"requestTemplate": "{\n\"filter\": \n\t{\n\t\t\"type\":\"or\",\n\t\t\"predicates\": [{\"dimension\": \"queueId\",\"value\": \"${input.QUEUE_ID}\"}]\n\t},\n\t\"metrics\":[\"oWaiting\"]\n}"
},
"response": {
"translationMap": {
"WaitingInQueue": "$.results[?(@.group.mediaType==\"voice\")].data[?(@.metric==\"oWaiting\")].stats.count"
},
"translationMapDefaults": {},
"successTemplate": "{\"CALLS_WAITING\" : ${successTemplateUtils.firstFromArray(\"${WaitingInQueue}\")}}"
}
},
"contract": {
"input": {
"inputSchema": {
"type": "object",
"required": [
"QUEUE_ID"
],
"properties": {
"QUEUE_ID": {
"type": "string"
}
}
}
},
"output": {
"successSchema": {
"title": "Count",
"type": "object",
"properties": {
"CALLS_WAITING": {
"type": "number"
}
}
}
}
},
"secure": false
}
It works as expected - returns only the number of calls waiting in queue (for the queue ID provided as Input)
------------------------------
Mariusz Ziemiecki
NA
------------------------------
Original Message:
Sent: 03-13-2026 15:55
From: Alesson Santos
Subject: In Queue Position before call enter the queue
Hello,
The POST endpoint api/v2/analytics/queues/observations/query allows you to query real-time queue observation metrics in Genesys Cloud.
This is particularly useful for retrieving live data, such as the current number of interactions waiting in a queue.
Example Request Body
JSON
{ "metrics": [ "oWaiting" ], "filter": { "type": "and", "clauses": [ { "type": "or", "predicates": [ { "dimension": "queueId", "value": "{queueID}" } ] } ] }}
You can make it more precise by also filtering on media type:
JSON
{
"results": [
{
"group": {
"queueId": "{queueId}",
"mediaType": "voice"
},
"data": [
{
"metric": "oWaiting",
"stats": {
"count": 1
}
}
]
}
]
}
Key Response Details
The relevant data is typically found in this path:
$.results[?(@.group.mediaType=='voice')].data[?(@.metric=='oWaiting')].stats.count
- Metric: "oWaiting"
- Common mediaType: "voice" (for phone calls; can also be "chat", "email", "callback", etc.)
- Meaning of the value: The count represents the current number of interactions (e.g., calls) in the waiting state in the specified queue at the exact moment of the query.
This value matches exactly what you see in the Genesys Cloud interface under:
- Queues Activity dashboard → Waiting column
- Performance Views → real-time queue statistics
In other words, it shows how many people/calls are currently queued and waiting for an agent - before your own new interaction enters the queue.
------------------------------
Alesson Santos
Mid-Level Developer