Author Topic: CometD notificiations from WWE using Python  (Read 6232 times)

Offline Mr.T

  • Newbie
  • *
  • Posts: 17
  • Karma: 3
CometD notificiations from WWE using Python
« on: April 18, 2020, 01:52:07 AM »
Anyone have any idea how to receive CometD notifications from WWE using Python?

Offline gen_rtfm

  • Full Member
  • ***
  • Posts: 114
  • Karma: 4
Re: CometD notificiations from WWE using Python
« Reply #1 on: April 18, 2020, 02:01:51 AM »
I imagine there is some python library built to add cometd support to your project, did a quick Google...

Out of curiosity, what's the use case/what are you aiming to do?

Br

Skickat från min Mi MIX 3 5G via Tapatalk


Offline Mr.T

  • Newbie
  • *
  • Posts: 17
  • Karma: 3
Re: CometD notificiations from WWE using Python
« Reply #2 on: April 18, 2020, 02:17:13 AM »
I imagine there is some python library built to add cometd support to your project, did a quick Google...

Out of curiosity, what's the use case/what are you aiming to do?

Br

Skickat från min Mi MIX 3 5G via Tapatalk

I want to get list of all agents from Genesys using WWE API (its done with Python OK), but need more information! I need the last time each one logged in Genesys and looking the Genesys documentation it can be done only using "interactions" (under Interactions History API), but it returns a CometD "refereceid". So I need to establish a "long-pooling" CometD in order to get these asyncrounous messages, but I have no clue how to establish connection with WWE using Comedt. I found Aiocometd lib for python, but both documentatons are very poor and there is no examples. Wondering if someone ever done that before, even in another language (java) or do you if there is another way to get a list of users and last time they logged in using another method besides this API?

Thank you!


Offline gen_rtfm

  • Full Member
  • ***
  • Posts: 114
  • Karma: 4
Re: CometD notificiations from WWE using Python
« Reply #3 on: April 18, 2020, 02:37:37 AM »
Without experience of the API but after sifting through the API description from genesys I'd say that your requirement falls outside the scope of the API.

Based on your description you want data from statserver, not WWE; are you restricted in your access to the environment?

You want your integration to retrieve data for all logged in agents or one specific?

As I understand the mentioned API that's used to fetch agents handling history, i.e. the interactions they've processed. This will not give you timestamps for login, only specifics about what interactions they've handled.

This is kind of secondary to your actual question, how to establish a cometd session between wwe and a python app. Unfortunately I can't help you there, I've never tried.

Skickat från min Mi MIX 3 5G via Tapatalk


Offline Mr.T

  • Newbie
  • *
  • Posts: 17
  • Karma: 3
Re: CometD notificiations from WWE using Python
« Reply #4 on: April 18, 2020, 03:06:31 AM »
The interaction history API from WWE can provide that info. I get 200OK HTTP response with the "refereceId". I just don't know how to asynchronously refer as cometd connection using that "referenceId"

Code: [Select]
HTTP response

   "statusCode":0,
   "referenceId":1
}

https://docs.genesys.com/Documentation/HTCC/latest/API/CHGetAgentInteractions

https://docs.genesys.com/Documentation/HTCC/latest/API/InteractionHistory


Offline gen_rtfm

  • Full Member
  • ***
  • Posts: 114
  • Karma: 4
Re: CometD notificiations from WWE using Python
« Reply #5 on: April 18, 2020, 04:34:08 AM »
Ok, here's a long shot simply trying to stitch together from different docs.genesyslab.com resources (full disclaimer - this is entirely speculation, hope it helps):

The cometd-client you're developing needs at the point in time you issue the http request to the API to be connected and subscribed to the corresponding channel where the data response will be sent.

It seems that the API has similar uri as the corresponding cometd channel, but cometd has replaced /api/v2/ucs/interactions with /api/v2/me/interactions (where 'me' indicates messages)

I assume that there will arrive a cometd-message on the corresponding topic when the request has been processed by the backend, and you need your client to await a message on that topic with the returned request_id from the http request you sent; you need to filter the messages in the cometd-client to get the response for that specific request, as all messages issued regardless of initiator will be published on that topic.

Looking here https://docs.genesys.com/Documentation/HTCC/8.5.2/API/AsynchronousEvents

I'd say that I'd try to simply listen in on /v2/me/devices channel to get login-events and save those to know who logged in at what time.

I can't find a topic corresponding to the /api/v2/ucs/interactions on that page though, maybe there is a cometd method for querying available topics? I guess that'd be in the official cometd documentation though, and hopefully the python library supports that method.

I found https://aiocometd.readthedocs.io/en/latest/ helpful in describing how to establish a session and subscribe to topics, at least it sounded 'sane' when I read it.

Br

Skickat från min Mi MIX 3 5G via Tapatalk


Offline Kubig

  • Hero Member
  • *****
  • Posts: 2739
  • Karma: 44
Re: CometD notificiations from WWE using Python
« Reply #6 on: April 18, 2020, 02:37:05 PM »
I would rather use PSDK for similiar tasks or to achieve the same goal as you want.
Genesys certified professional consultant (GVP, SIP, GIR and Troubleshooting)

Offline Mr.T

  • Newbie
  • *
  • Posts: 17
  • Karma: 3
Re: CometD notificiations from WWE using Python
« Reply #7 on: April 18, 2020, 11:33:23 PM »
I would rather use PSDK for similiar tasks or to achieve the same goal as you want.

I can't connect directly to Config Server. its a cloud version, only access is thru web or api.

Offline gen_rtfm

  • Full Member
  • ***
  • Posts: 114
  • Karma: 4
Re: CometD notificiations from WWE using Python
« Reply #8 on: April 24, 2020, 02:21:04 AM »
I would rather use PSDK for similiar tasks or to achieve the same goal as you want.

I can't connect directly to Config Server. its a cloud version, only access is thru web or api.
Did you have any luck with the cometd session?

Skickat från min Mi MIX 3 5G via Tapatalk


Offline jarrod

  • Newbie
  • *
  • Posts: 42
  • Karma: 1
    • InProd CMS
Re: CometD notificiations from WWE using Python
« Reply #9 on: June 03, 2020, 08:54:59 AM »
You can also use Jython to access the PSDK library. We did that for the first version of our product as a prototype and then converted it into pure Java which might have been a waste of time.

It was relatively easy to do, I can pull out some of the code if you are interested. But we were connecting to the config server on, still it will you you some insight on how to get started.
InProd is a DevOps, auditing, configuration management and license reporting solution for Genesys Engage. Learn how to speed up deployments by creating reusable changes  www.inprod.io