Legacy Dev Forum Posts

 View Only

Sign Up

Query for max waiting time in queue

  • 1.  Query for max waiting time in queue

    Posted 06-05-2025 18:41

    David_Lefevre | 2020-07-17 09:09:18 UTC | #1

    Hello, I trie to request the max waiting time in a queue (in real time) with a conversation aggregate query. I don't understand why this query is not giving me only the calls that are always in queue without speaking with an agent.

    If somebody could find where I am wrong it would be helpful for me.

    INPUT CONTRACT : { "title": "Maxcallwait", "type": "object", "properties": { "QUEUE_ID": { "type": "string" }, "INTERVAL": { "type": "string" } }, "additionalProperties": true }

    OUTPUT CONTRACT : { "title": "Maxcallwait", "type": "object", "properties": { "Max_Wait": { "type": "number" } }, "additionalProperties": true }

    RESUEST URL TEMPLATE : /api/v2/analytics/conversations/aggregates/query

    REQUEST BODY : { "interval": "${input.INTERVAL}", "order": "asc", "orderBy": "conversationStart", "paging": { "pageSize": 25, "pageNumber": 1 }, "segmentFilters": [ { "type": "and", "predicates": [ { "type": "dimension", "dimension": "mediaType", "operator": "matches", "value": "voice" }, { "type": "dimension", "dimension": "userId", "operator": "notExists", "value": null }, { "type": "dimension", "dimension": "segmentEnd", "operator": "notExists", "value": null }, { "type": "dimension", "dimension": "purpose", "operator": "matches", "value": "acd" }, { "type": "dimension", "dimension": "queueId", "operator": "matches", "value": "${input.QUEUE_ID}" } ] } ], "metrics": ["tWait"] }

    RESPONSE : { "translationMap": { "MaxWait": "$.results[0].data[0].metrics[0].stats.max" }, "translationMapDefaults": { "MaxWait": "null" }, "successTemplate": "{\n \"MaxWait\": ${MaxWait}\n }" }


    Jason_Mathison | 2020-07-17 12:52:15 UTC | #2

    Hi David, Welcome to the forum!

    Have you been able to use something like the Analytics Query Builder to get the results that you expect? https://developer.mypurecloud.com/developer-tools/#/analytics-query-builder

    We always suggest that you get the API working as expected in Postman or a specialized tool like the query builder before making a data action out of it.

    --Jason


    system | 2020-08-17 12:52:20 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 8317