cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3848
Views
2
Helpful
5
Replies

Connecting JavaScript XMPP client to the finesse notifications service

nicolas.cordier
Level 1
Level 1

Hey everybody!

For my job, I need to design a cisco agent interface from scratch. To do this, I need to be able to listen to finesse API notifications. I found out that those notifications are pushed through XMPP (which I can retrieve fine using Pidgin just as detailed in the lab).

My problem is the following:

I have the following setup:

Client.js <=> Node.js <=> Finesse Server

I need to get Finesse notifications on the Node.js server (fetching them on the client would mean extreme and unnecessary server load).

I tried several things, but somehow, I just can't achieve to get the notifications on my Node.js server. I tried using xmpp-node library, but apparently there are no notifications pushed through it except at the trigger of the "online" event which seems to work fine. Then no "stanza" nor "data" events are ever triggered.

I then tried to do what is written in the Cisco documentation (https://developer.cisco.com/media/finesseDevGuide4.1/CFIN_RF_M692B5FE_00_managing-notifications-in-third-party-apps.html) but it doesn't seem to do anything on my side (even when trying with the client part of my application).

I'm totally confused and have absolutely no idea what to do here... Could someone give me some insight about this please?

Thanks very much!

1 Accepted Solution

Accepted Solutions

Thanks for your help Denise, I finally fixed the issue. I'm not sure what was causing all this trouble, but the problem was coming from the behavior of the xmpp protocol inside node. Since I'm not a XMPP expert (and cannot afford time learning XMPP extensively) I tried to find another (so a 4th one) XMPP module for Node.js. I finally found this:

GitHub - simple-xmpp/node-simple-xmpp: Simple High Level NodeJS XMPP Client

And it instantly worked perfectly. I think Finesse wants more than juste one subscription request to be able to send notifications, or that something went terribly wrong with the previous module. Anyway, everything is working now, and if anyone encounter a similar issue, you have a solution to offer them for Node.js.

View solution in original post

5 Replies 5

dekwan
Cisco Employee
Cisco Employee

Hi Nicolas,

Can I ask you why you feel that fetching the events on the client would be extreme overload? The Finesse notifications are built where each agent has to make its own connection to the Finesse notification service. In this connection, it will only receive events relevant for this user. For example, if you log in agent1 and establish the connection to the notification service, this feed will only get events for agent1. Also, Finesse only sends events when there is a change, which means each notification is relevant to the user.

The out of the box Finesse agent desktop fetches the notifications from the notification service and there isn't anything in between.

As far as your connection from node.js <-> Finesse Notification Service, what user/credentials are you using to make the connection? Are you sure you have the right security settings? You have to "allow plaintext authentication over unencrypted streams" as well as "using encryption if available". When I did this using python, the authentication/security was my issue.

Thanx,

Denise

Well I don't feel that way but my boss does. We have a pool of 8000 agents working on our Finesse server, I don't think this would be so much of a load, especially using another server as buffer (our Node.js server) but my boss says it would be extreme server charge so I believe it will. Anyway I don't really have any latitude on this whatsoever...

Currently I'm using the same login/password as I use in Pidgin with the same setup, however it doesn't seem to be a way to define security options with my client. The "online" event gets triggered but I don't receive any informations after that. Since you asked me another question on Spark, I will answer it here to centralize the information on a more durable format. While using Pidgin, everything works like a charm, I get all notifications I need through Pidgin XMPP console (why not simply use stanza instead of console events since the security must be turned off anyway...?) but never when I use my client inside Node.js. Moreover, I tried to follow the official documentation regarding Finesse notifications, but it is super light, and a lot of informations are missing.

I will try a different client today, could you provide me some sample code on using Finesse notification service through a browser please? I can't achieve to make it work properly.

Thanks a lot for your help!

EDIT: After trying another client, it didn't change anything. Then I tried to mess with the options of my client (which lend better results than the new one) and found the option : preferredSaslMechanism and forced it to "PLAIN" but again, didn't change a thing. Any sample code is more than welcome! \o/

EDIT2: After being on the edge of madness, I decided to use Wireshark to see what was going between my Node.js and Finesse and between Pidgin and Finesse. When Pidgin is doing the work, everything works fine, because Finesse actually sends stanza, but when Node.js is doing the work, Finesse isn't sending any stanza. I believe this is because I am not subscribed (however, this would mean an incorrect information is present in the official Finesse documentation, which states users are automatically subscribed to certain notifications, while it doesn't seem to be true). I tried to subscribe following the official documentation (which is very very different from what Pidgin is doing to subscribe) and it doesn't work. I will continue investigate this issue.

EDIT3: In fact, subscribing simply didn't change anything. After sniffing the TCP interactions again, Finesse does send notifications to Pidgin, but totally ignores my Node.js except when I send it something (like the subscription). Did I miss something from the documentation to tell Finesse to actually send me notifications?

Hi Nicholas,

Like you stated (and per documentation), agents are automatically subscribed to the /User and /User/{id}/Dialogs nodes. So after establishing a successful connection to the Finesse notification service, you should receive the events when they are triggered.

My suspicion is that your connection to the Finesse notification service is successfully logged in. It is probably able to connect to the notification service (hence the "online"), but not log in successfully. This happened to me when I was doing this via python. Here is the sample code for that: finesse-sample-code/NonGadgetPythonSample at master · CiscoDevNet/finesse-sample-code · GitHub

Here is also sample code on how to do it via browser: finesse-sample-code/NonGadgetSample at master · CiscoDevNet/finesse-sample-code · GitHub

After reviewing my python code, it does have to be PLAIN as well as TLS (not SSL). I believe specifically TLS 1.2 (but I have to double check that).

I don't have any experience connecting to the notification service with node.js so unfortunately I don't have any direct examples.

I hope this helps!

Thanx,

Denise

Thanks for your help Denise, I finally fixed the issue. I'm not sure what was causing all this trouble, but the problem was coming from the behavior of the xmpp protocol inside node. Since I'm not a XMPP expert (and cannot afford time learning XMPP extensively) I tried to find another (so a 4th one) XMPP module for Node.js. I finally found this:

GitHub - simple-xmpp/node-simple-xmpp: Simple High Level NodeJS XMPP Client

And it instantly worked perfectly. I think Finesse wants more than juste one subscription request to be able to send notifications, or that something went terribly wrong with the previous module. Anyway, everything is working now, and if anyone encounter a similar issue, you have a solution to offer them for Node.js.

Hi Nicolas,

Good to hear that it is working for you and thank you for posting your solution.

Thanx,

Denise

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: