Yasufumi.Ikeda | 2020-08-10 02:54:29 UTC | #1
Hello, I'm trying to get current longest waiting time in a queue, using notifications topic "v2.analytics.queues.{Id}.observations". But I can't find metrics about longest waiting time.
and I found a forum topic about it. https://developer.mypurecloud.com/forum/t/longest-waiting-time/1175
does anyone know PURE-975 was relieased?
If PURE-975 is not relieased, I'll use queue notifications and iterate all interactions to find Longest Waiting Time.
Appreciate your advice.
Thanks, Yasufumi Ikeda
HirotoMasaki | 2020-08-10 06:27:53 UTC | #2
Hi Ikeda-san, thanks for initiating and participating in the developer forum discussion! As far as PURE-975 is concerned, it was released as old as in March 2019. See "Queue query enhancement in Analytics API" section in https://help.mypurecloud.com/releasenote/march-6-2019/. I'd have to defer to the developer evangelists for the best answer, but highly likely you are suggested to use POST /api/v2/analytics/queues/observations/query with detailMetrics option pointing to oWaiting. See https://developer.mypurecloud.com/api/rest/v2/analytics/queue.html.
A sample body I've used for my quick local testing is described here. Please use your own QueueID (UUID value) and not mine. In the response, you would get something like "observationDate":"2020-08-10T06:15:42.926Z", and I guess you have to make your calculation to determine the longest waiting in seconds or milli seconds. This is actually the part which I need help with from developer evangelists. Thanks.
{ "filter": { "type": "or", "predicates": [ { "type": "dimension", "dimension": "queueId", "operator": "matches", "value": "cd0fd71f-bd03-49c8-830d-c00d0ccf5d9b" } ] }, "detailMetrics": [ "oWaiting" ] }
Yasufumi.Ikeda | 2020-08-11 10:01:57 UTC | #3
Hi Masaki-sama, thanks for your quick reply from Tokyo. I should have called you, maybe...
I understood your advice and sample code.
Then, your idea is polling query, and there is no notification topic for longest waiting time, is it right? I already use notification handler to get waiting interaction count and other data. So it's easy to get one more data from it.
But if there is no way to get longest waiting time from notification handler, I'll use POST /api/v2/analytics/queues/observations/query when waiting interaction count changed in notification handler, or polling at a certain interval.
Appreciate your advice.
Thanks, Yasufumi Ikeda
peter.westermann | 2020-08-17 15:52:31 UTC | #4
The notifications you get via "v2.analytics.queues.{Id}.observations" have the same details as detail metrics requested via "/api/v2/analytics/queues/observations/query". If there are waiting conversations, the notifications and the endpoint will return a sorted list of those. The first entry is the longest waiting conversation.
The payload for notifications should look similar to this:
{
"results": [{
"group": {
"mediaType": "voice"
},
"data": {
"metric": "oWaiting",
"stats": {
"count": 1
},
"observations": [{
"observationDate": "2020-08-01T01:01:01.003Z",
"conversationId": "1c22ee76-7f10-4767-b1cc-eda7c5c9c43d",
"sessionId": "a06b2701-6ba6-4e7f-b6f8-1a3e0d7d26fa",
"requestedRoutingSkillIds": ["85942153-9cff-4486-8b96-d870b1791d46"],
"routingPriority": 100,
"userId": "a67780e6-118d-4cbf-aba2-9367c79b8819"
}],
"truncated": false
}
}]
}
You can use observationDate to calculate how long it's been waiting.
HirotoMasaki | 2020-08-18 23:41:05 UTC | #5
Thanks Peter for sheding a light here!
Yasufumi.Ikeda | 2020-08-22 04:31:11 UTC | #6
Hello Peter, Thanks for your reply!
I tried "v2.analytics.queues.{Id}.observations" in developer tool "https://developer.mypurecloud.jp/developer-tools/#/notificationtester", subscribed to Queue statistic observations "v2.analytics.queues.{id}.observations".
And I got this notification when waiting conversations changed:
{ "group": { "queueId": "{id}", "mediaType": "voice" }, "data": [ { "interval": "2020-08-22T04:02:43.375Z/2020-08-22T04:02:43.375Z", "metrics": [ { "metric": "oWaiting", "stats": { "count": 2 } } ] } ] }
I could not find "observations" section in the notification.
Maybe I misunderstand something basic.
I appreciate any help.
Thanks, Yasufumi Ikeda.
peter.westermann | 2020-08-24 12:24:37 UTC | #7
My bad, I was thinking of a different notification topic that is used by our UI: v2.analytics.queues.{id}.observations.details
That one is hidden as it's only used internally (and there may be changes to the format in the future). You can try using it. If that doesn't work for you, I am afraid you will have to keep using api/v2/analytics/queues/observations/query.
Yasufumi.Ikeda | 2020-08-24 23:40:50 UTC | #8
Hello Peter, Thanks for your reply!
I could get "observations" section using v2.analytics.queues.{id}.observations.details.
I understand it's not public and there may be changes to the format in the future. if I use the notification, i'll be careful about it.
Thank you for your kind support.
Yasufumi Ikeda.
system | 2020-09-24 23:40:50 UTC | #9
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: 8526