Real-Time tWait Tracking

I'm looking for an Endpoint or Websocket to give near real-time updates (every 15 seconds at a minimum) for only currently waiting calls/emails:

  • How long calls/emails have been waiting (tWait)
  • The longest conversation's wait time (only for calls/emails currently waiting)
  • The average waiting time (only for calls/emailscurrently waiting)

The Conversations Aggregates Query does give the required information in the following format:

{
  "results": [
{
  "group": {
    "conversationId": "04c89340-26ba-41b4-ad6a-3d9492a9cd6f",
    "mediaType": "voice",
    "queueId": "86a90d2b-24cb-483a-9d02-14c10b80bab7"
  },
  "data": [
    {
      "interval": "2022-07-25T22:00:00.000Z/2022-07-26T22:00:00.000Z",
      "metrics": [
        {
          "metric": "tWait",
          "stats": {
            "max": 19567,
            "min": 19567,
            "count": 1,
            "sum": 19567
          }
        }
      ]
    }
  ]
},

However, querying this endpoint does not make sense to retrieve only conversations that are currently waiting, at a 15 second refresh interval.
I've explored WebSockets. Unfortunately, I cannot find the equivalent WebSocket for the Conversations Aggregates Query.

Similar to the below screenshot, from GenesysCloud, there is a live Duration metric that is auto refreshing every second or two:

Any assistance or guidance on how best to extract these data points would be greatly appreciated.

Thank you

Standard Websockets do not support filtering, they're event driven firehoses not queries.

The only way to achieve what you want using the GA websockets is to create a stateful app that listens to the queues and records / updates in real time.

The report you reference is running a Preview API:

POST /api/v2/analytics/conversations/activity/query

{"order":"asc","filter":{"type":"or","predicates":[{"type":"dimension","dimension":"queueId","value":"queue-id-goes-here"}]},"groupBy":["queueId"],"metrics":[{"metric":"oWaiting","details":true}],"subscribe":true}

Note the subscribe option is presently undocumented, but the query result returns a websocket topic descriptor and expiration;

,"topic":"v2.analytics.conversations.activity.queue.queue-id-goes-here.subscription.651dbebc-35bd-173d-6269-c40a523bd847"}],"subscriptionExpirationDate":"2022-07-26T12:35:58.996Z"}

So what you want may be available to General Audiences in the near future or something you can ask customer support to enable for you as a beta.

Thank you for your response Eos_Rios.

I am still a bit unclear as to what I should be looking for.
I agree that a WebSocket is the correct way of retrieving all Queue updates in real-time. My intention is to subscribe to multiple topics at the same time in order to get updates for all queues.

Which WebSocket Topic should I subscribe to in order to get the following data points for queues:
(only for currently waiting calls/emails)

  • How long calls/emails have been waiting (tWait)
  • The longest wait time
  • The average waiting time

The documentation for the endpoint POST /api/v2/analytics/conversations/activity/query that you've suggested does not list tWait as an allowed metric. I only see oWaiting, oAlerting, oInteracting.

Thanks again for your assistance

Step 1. Write an application.
Step 2. Create an object in your application for each Queue you are tracking and the values you want to keep track of.
Step 3. Subscribe to every queue you want to track via v2.routing.queues.{id}.conversations

*If you are only interested in a single media type you can be more specific but it's also only worth limiting if the queue in question actually gets more than one media type.

Step 4. Parse every every event from those queues to determine if they have changed the state of your object and update it accordingly.