Dashboard Real time Data Extraction

Hi Ronan,

How can I create a new channel for the special notifications.

Notifications-->Channel-->Subscription-->topic

Is the above flow correct? I want to create a custom python code for real time data, can you please share the steps for it as I am bit confused between observation api and notification service.

Also can I use only observation api endpoints for real time data and not notification service ?

Thanks,

Abhijeet Hivarkar

Hi Abhijeet,

You can see the steps using the CLI as an example here.

You could use the observation api endpoints to get the data, but I would highly recommend against using this data endpoint if you are going to be polling it every second. You will quickly run into rate limits for this approach.

I always give people the advice that you use the notification service if you must get the near-time updates and changes. Use an endpoint call if you have some tolerance for older data. However, with polling you always have to keep your polling calls beneath the rate limits associated with API calls.

Hope that helps.

Thanks,
John Carnell
Manager, Developer Engagement

Hi John,

Thanks for your input.

I understand that Notification services is best for real time read. The only struggle is to implement it. If you have any python/.net code reference then it will be helpful.

How the authentication will be done in case of notification service how to consume it, how I can create a new channel in case I need . So many questions I have.

If you can guide more on it then it will be helpful, I am also tried to understand and connect the dots between previously shared references.

Thanks,

Abhijeet Hivarkar

Hello,

Notification services is part of the Platform API.
So you need to authenticate via an OAuth flow (Implicit Grant if you are using user credentials/context, Client Credentials Grant for server side connectivity), creating an OAuth client.

This page explains how to use the notification service.

This tutorial, in python, shows an example that uses the Notifications API/service (using an OAuth Client Credentials Grant client): https://developer.genesys.cloud/api/tutorials/real-time-queue-observation-query/#language=python&step=0
The tutorial subscribes to Queue Conversations notifications - and upon a notification it sends a Queue Observations Query (Analytics - Platform API).
Making a Queue Observations Query is not something mandatory. You can also subscribe to the v2.analytics.queues.{id}.observations topic (Queue statistic observations).
See here for a list of available topics.

Regards,

Hi Jerome,

Thanks for your guidance.

I saw there is only one queue getting assigned in the channel topic for a notification service https://developer.genesys.cloud/api/tutorials/real-time-queue-observation-query/#language=python&step=0

How can I utilize to use this code and get notifications for more than 1 queue.

Thanks,

Abhijeet Hivarkar

Hello,

You can subscribe to several topics using the same notification channel/websocket.
See here.
Each websocket can accept/manage up to 1000 topics. See here.

So you just need to send multiple topics in your subscription request (v2.analytics.queues.{id}.observations topic for Queue1, v2.analytics.queues.{id}.observations topic for Queue2, ...).
It is also possible to send multiple subscription requests - using the POST based API endpoint (to add subscriptions - see info below).

Note that POST /api/v2/notifications/channels/{channelId}/subscriptions - python: post_notifications_channel_subscriptions adds a list of subscriptions to the existing list of subscriptions
And that PUT /api/v2/notifications/channels/{channelId}/subscriptions - python: put_notifications_channel_subscriptions replaces the current list of subscriptions with a new list.

Regards,

Hi Jerome,

Thanks for sharing the helpful information. I checked the queue observation and I see it is not giving the real time data for Agents with their name and current status per agent like below image,

Can you please share from where we can get this information Agent based and We can add/remove the agents from the alerts.

Thanks,

Abhijeet Hivarkar

Hello,

The Dashboards and Widgets are not documented (to list which API requests are being called by the Genesys Desktop).

What I would recommend (and this is what I usually do in these cases) is to leverage your browser network logs, when you display a dashboard, to see what the Genesys Desktop is exactly requesting (Analytics queries, observations, subscription to notification topics, ...).
I am using Chrome. So I select the Network Logs in the Chrome Developer Tools and I display my dashboard (usually starting with a Dashboard which contains a single widget to make it easier to parse/read). When the Dashboard is selected/displayed, it will make the different requests.

Regards,

Hi Jerome,

Thanks for your inputs. I managed to get the required information through api explorer.

Can you please share where I can get real time data based on Skills, for example which skill is having waiting call and how many are in waiting.

Thanks,

Abhijeet Hivarkar

Hello,

There is no Platform API request dedicated to skills.

You can perform a query for queue observations and request oWaiting in metrics and detailMetrics.
The requestedRoutingSkillIds dimension will be provided in the response, if available.

So you would have to request this for all the queues you are interested in, and via your code, parse the results to extract the calls with a specific requestedRoutingSkillId (observations array attribute).
The requestedRoutingSkillIds are not provided in v2.analytics.queues.{id}.observations topic.

Regards,

Hi Jerome,

I created a channel through python and subscribed couple of topics to it. After running for some time it stopped with below error message,

code = 1006 (connection closed abnormally [internal]), no reason

Can you please guide the reason behind the same.

Thanks,

Abhijeet Hivarkar

I don't know the cause. You will have to investigate in your client/code.

According to the answer on this stackoverflow post:
"Close Code 1006 is a special code that means the connection was closed abnormally (locally) by the browser implementation.

If your browser client reports close code 1006 , then you should be looking at the websocket.onerror(evt) event for details."

Regards,

Hi Jerome,

Thanks for the quick reply.

Do you have any reference code as to where and how to catch the websocket exceptions?

Also the queue observation topic respond in three different metric categories like below,
Category 1
{'topicName': 'v2.analytics.queues.b8749577-2cf8-4d17-9df2-cdc2cfe082fd.observations', 'version': '2', 'eventBody': {'group': {'queueId': 'b8749577-2cf8-4d17-9df2-cdc2cfe082fd'}, 'data': [{'interval': '2021-08-19T12:56:16.035Z/2021-08-19T12:56:16.035Z', 'metrics': [{'metric': 'oActiveUsers', 'stats': {'count': 48.0}}, {'metric': 'oMemberUsers', 'stats': {'count': 64.0}}, {'metric': 'oUserRoutingStatuses', 'qualifier': 'OFF_QUEUE', 'stats': {'count': 48.0}}, {'metric': 'oUserPresences', 'qualifier': '6a3af858-942f-489d-9700-5f9bcdcdae9b', 'stats': {'count': 6.0}}, {'metric': 'oOffQueueUsers', 'qualifier': '6a3af858-942f-489d-9700-5f9bcdcdae9b', 'stats': {'count': 6.0}}, {'metric': 'oUserPresences', 'qualifier': 'ccf3c10a-aa2c-4845-8e8d-f59fa48c58e5', 'stats': {'count': 42.0}}, {'metric': 'oOffQueueUsers', 'qualifier': 'ccf3c10a-aa2c-4845-8e8d-f59fa48c58e5', 'stats': {'count': 42.0}}]}]}, 'metadata': {'CorrelationId': '0a4ca781-1732-4ff6-81dc-f0a03c05a644'}}

Category 2
{'topicName': 'v2.analytics.queues.e25798c8-0d7d-4b44-a6a3-574511c18f0d.observations', 'version': '2', 'eventBody': {'group': {'queueId': 'e25798c8-0d7d-4b44-a6a3-574511c18f0d', 'mediaType': 'voice'}, 'data': [{'interval': '2021-08-19T13:00:00.000Z/2021-08-19T13:30:00.000Z', 'metrics': [{'metric': 'nConnected', 'stats': {'count': 3.0}}, {'metric': 'tAcw', 'stats': {'count': 2.0, 'sum': 60000.0, 'min': 30000.0, 'max': 30000.0}}, {'metric': 'tHandle', 'stats': {'count': 2.0, 'sum': 118395.0, 'min': 39445.0, 'max': 78950.0}}, {'metric': 'nOutbound', 'stats': {'count': 3.0}}, {'metric': 'tDialing', 'stats': {'count': 3.0, 'sum': 34892.0, 'min': 5150.0, 'max': 21977.0}}, {'metric': 'tTalk', 'stats': {'count': 4.0, 'sum': 855491.0, 'min': 9445.0, 'max': 762831.0}}, {'metric': 'nError', 'stats': {'count': 1.0}}, {'metric': 'nConsult', 'stats': {'count': 1.0}}, {'metric': 'tContacting', 'stats': {'count': 3.0, 'sum': 6842.0, 'min': 1444.0, 'max': 3223.0}}, {'metric': 'tTalkComplete', 'stats': {'count': 2.0, 'sum': 48406.0, 'min': 9445.0, 'max': 38961.0}}]}]}, 'metadata': {'CorrelationId': '6b72ad11-c126-4557-93bc-a48dc2b0296a'}}

Category 3

{'topicName': 'v2.analytics.queues.b8749577-2cf8-4d17-9df2-cdc2cfe082fd.observations', 'version': '2', 'eventBody': {'group': {'queueId': 'b8749577-2cf8-4d17-9df2-cdc2cfe082fd', 'mediaType': 'voice'}, 'data': [{'interval': '2021-08-19T13:06:53.783Z/2021-08-19T13:06:53.783Z', 'metrics': [{'metric': 'oWaiting', 'stats': {'count': 3.0}}, {'metric': 'oInteracting', 'stats': {'count': 2.0}}]}]}, 'metadata': {'CorrelationId': '697dd1fb-4809-4c64-9a45-2a4a461fbe79'}}

So can I control this response , for example if I want only category 2 response and I want to ask for some set of metrics in category 2 response only .

Thanks,

Abhijeet Hivarkar

Hello,

"Do you have any reference code as to where and how to catch the websocket exceptions?"
No I don't. This relates to regular websocket libraries - not specific Genesys Cloud - so I would just search on google as I am sure some people described it.

The queue observation topic will publish a notification if there is something to report on.
If it is a change in active users/members/routing statuses for the corresponding queue, it will look like category 1.
If it is about waiting calls in queue, like caegory.
If it is about connected/acw/... (conversations that got connected to an agent), like category 2.
There is no setting to ask for a specific set of info via the topic/notification.
So you will have to filter this in your code.

Regards,

Hi Jerome,

Thanks for your clarification.

Also I wanted to check why we are getting the topic response in single quotes. Can we have the topic response in double quoted json string? Can this be done by some settings please let me know

Thanks,

Abhijeet Hivarkar

Answered here

Hi Jerome,

Thanks for your quick response. I will use json.dums and will let you know.

Thanks,

Abhijeet Hivarkar

Hi Jerome,

Got below error while calling queue observation endpoint,
Error 1 attempt:
{"message": "The request timed out.", "code": "gateway.timeout", "status": 504, "details": [], "errors": []}
Error2 attempt:
{"message": "Server resources aren't available to complete the request. Please try again shortly.", "code": "service.unavailable", "status": 503, "messageParams": {}, "contextId": "90e3fa98-3c4e-4f88-b281-7a32335c748b", "details": [], "errors": []}

can you share the reason behind this.

Thanks,

Abhijeet Hivarkar

I suggest to open a ticket with Genesys Cloud Customer Care.

Regards,

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