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

Offline Mr.T

  • Newbie
  • *
  • Posts: 17
  • Karma: 3
CometD notificiations from WWE using Python
« on: April 17, 2020, 04:52:07 PM »
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 17, 2020, 05:01:51 PM »
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 17, 2020, 05:17:13 PM »
[quote author=gen_rtfm link=topic=11587.msg52800#msg52800 date=1587142911]
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
[/quote]

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 17, 2020, 05:37:37 PM »
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 17, 2020, 06:06:31 PM »
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]HTTP response

  "statusCode":0,
  "referenceId":1
}[/code]

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 17, 2020, 07:34:08 PM »
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: 2752
  • Karma: 44
Re: CometD notificiations from WWE using Python
« Reply #6 on: April 18, 2020, 05:37:05 AM »
I would rather use PSDK for similiar tasks or to achieve the same goal as you want.

Offline Mr.T

  • Newbie
  • *
  • Posts: 17
  • Karma: 3
Re: CometD notificiations from WWE using Python
« Reply #7 on: April 18, 2020, 02:33:23 PM »
[quote author=Kubig link=topic=11587.msg52805#msg52805 date=1587188225]
I would rather use PSDK for similiar tasks or to achieve the same goal as you want.
[/quote]

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 23, 2020, 05:21:04 PM »
[quote author=Mr.T link=topic=11587.msg52807#msg52807 date=1587220403]
[quote author=Kubig link=topic=11587.msg52805#msg52805 date=1587188225]
I would rather use PSDK for similiar tasks or to achieve the same goal as you want.
[/quote]

I can't connect directly to Config Server. its a cloud version, only access is thru web or api.
[/quote]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 02, 2020, 11:54:59 PM »
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.