cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
9391
Views
14
Helpful
28
Replies

How to subscribe to pub sub nodes in Finesse

yogeshkumarlog
Beginner
Beginner

I am trying to subscribe an agent to Team and Queue notification.

I have used(edited) code from non gadget sample.

The request captured from fiddler looks something similar to:

For Team Subscription:

POST /finesse/api/Team/8945/Users HTTP/1.1

Where 8945 is the agent ID

Response :

                HTTP/1.1 404 Not Found

                To test it I also tried User notification:

                                POST /finesse/api/User/8945 HTTP/1.1

                Response

                                HTTP/1.1 405 Method Not Allowed

                                Allow: GET,OPTIONS,HEAD,PUT

The added code to non gadget sample for team subscription:

  this.subscribeToTeam = function (agentId, resource, handler, errHandler) {

        var method = "POST",

        url = _webappPath + "/api/Team/" + agentId + "/Users",

        params = { "resource": resource };

        _sendReq(url, method, null, params, handler, errHandler);

};

Can someone please help me to subscribe to the new nodes for notification in Finesse?

28 Replies 28

Your java app must connect via XMPP and subscribe to a node using an iq message.

See the Finesse Webservices Developer Guide section on Subscription Management Notifications.

You cannot publish to a node yourself. You can only subscribe to nodes that are published by the Finesse server.

Gadgets do not publish to a node.

The openajax hub runs in the browser only. It does not involve the Finesse server. Gadgets posting to the hub can communicate with other gadgets but not via the server to a java app.

Right ... And If we want to subscribe to a node published by finesse server

using an iq message in Java Script file of Gadget then will we have to use

strophe js library or there is some other way too ?

Can you give example code snipet in which we can subscribe to finesse node

in gadget java script file using stroph js or some other way ?

Thnks for your help.

You don’t send an iq in gadget javascript, that is only for a non-gadget implementation.

The Finesse javascript library handles subscribing to nodes.

For example, to subscribe to a supervisor’s team:

_teams[id] = )

};

Finesse will invoke the _onTeamChange event whenever the team node changes for that team id.

The HubTopicSampleGadget demonstrates how to publish to a type of request.

var data = ,

invokeID: (new Date()).getTime()

};

gadgets.Hub.publish("sampleGadget.info", data);

Prior to this you subscribe to the topic such as:

gadgets.Hub.subscribe("sampleGadget.info", _dataRequestHandler);

The code snippet above subscribes to and publishes to the sampleGadget.info topic.

For a team notification subscribe to

See the Finesse WebServices Developer Guide section on SubscribeNodeReq to subscribe to a specific node.

See the Finesses WebServices Developer Guide section on Finesse Responses for the topic to subscribe to for Node notifications.

I left out:

For a team notification subscribe to

/Users"

},

invokeID:

"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"

}

You get the results of the notification on the finesse.info.responses. topic

This is how I am trying to subscribe to Agent State Change Finesse

Notification:

$( document ).ready(function() {

/establishing connection/

console.log("Connection Object XYZ");

var conn = new Strophe.Connection('http://192.168.200.157/');

console.log("Going to Connect to Finesse Server");

conn.connect('47010', 'cisco', function (status) {

if (status === Strophe.Status.CONNECTED) {

console.log("Sucessfully Connected to Finesse Server");

} else if (status === Strophe.Status.DISCONNECTED) {

console.log("ERROR! NOT Sucessfully Connected to Finesse Server");

} else if (status === Strophe.Status.CONNECTING) {

console.log("Strophe is still connecting.");

} else if (status === Strophe.Status.CONNFAIL) {

console.log("Strophe failed to connect.");

} else if (status == Strophe.Status.DISCONNECTING) {

console.log("Strophe is disconnecting.");

} else if (status == Strophe.Status.DISCONNECTED) {

log("Strophe is disconnected.");

}

});

console.log("Process of connecting Finesse Server Finished");

console.log("Going to Subscribe to Node");

/now subscribe/

var subiq = $iq()

.c('pubsub', )

.c('subscribe', );

console.log("Sending IQ Request to XMPP server to connect to Node");

conn.sendIQ(subiq, _dataRequestHandler, _wrongRequestHandler);

console.log("IQ Requests Has Been

Sent............................................................................................................................................");

/Method to handle the requests/

var _dataRequestHandler = function (topic, data) {

/Ensure a valid data object with "type" and "data" properties./

console.log("Agent State Changed

...........................................!!!!!!!!!!!!!!!!!!!!!!!!!!...........................................................");

console.log(data.data);

};

/Method to handle the wrong requests/

var _wrongRequestHandler = function (iq) {

console.log("Request Failed or Timed

Out.........................!!!!!!!!!!!!!!!!!!!!!!!!!!!....................................");

};

gadgets.window.adjustHeight();

});

</script>

But each time I get message ""Strophe is still connecting." And my call

back method is not called to when I change the state of an agent.

You cannot use strophe you need to use the opensocial container functions using the gadgets.hub.publish and gadgets.hub.subscribe.

You cannot use XMPP directly from inside a gadget you need to use the hub, the Finesse desktop maintains a single BOSH connection for all the gadgets.

I have done this through pidgin and receiving notifications too ... But I

am un-able to do this through java script in gadgets.

bavly
Beginner
Beginner

Hi yogesh , dlender

I want to ask about how do you get this number 5001 in

<subscribe node='/finesse/api/Team/5001/Users'

from which API

from get Team API Team—Get Team or get user API User—Get User?

dekwan
Cisco Employee
Cisco Employee

Hi,

You get the number 5001 (which is the TeamId) from User-Get User. The User-Get User will list out all of the teams the user belongs to.

Thanx,

Denise

Dear dekwan

that is the message i sent over xmpp

<iq type='set'

from = 'ShanelleMacks@finesse1.dcloud.cisco.com'

to='pubsub. finesse1.dcloud.cisco.com'

id='sub1'>

<pubsub xmlns='http://jabber.org/protocol/pubsub'>

<subscribe node='/finesse/api/Team/5013/Users'

jid='ShanelleMacks@finesse1.dcloud.cisco.com'/>

</pubsub>

</iq>

Please if it has something wrong please let me know

How to check if the subscribe node that i send over XMPP is working fine or not ?

in the message this link is constant ?

  "< pubsub xmlns = 'http://jabber.org/protocol/pubsub' />"

because when i go to this link http://jabber.org/protocol/pubsub give me 404 not found


also when we subscribe to team after login or when call ?


Thanks
Bavly


dekwan
Cisco Employee
Cisco Employee

Hi Bavly,

Assuming the userid is ShanelleMacks, the message seems correct.

To check if the subscription is working, make an agent state change to an agent in that team. ShanelleMacks should be receiving that agent state change notification.

You should subscribe to the team where applicable. In the Finesse desktop, the supervisor subscribes to the team when it is selected in the team performance gadget. It isn't automatically subscribed when the supervisor logs in due to performance.

Thanx,

Denise

Dear

dekwan

I have another question how to get Agent Statistics Report like duration time of login (Ready & Not Ready) all of that statistics


is there any rest API or using XMPP bosh message to send to get that statistics

thanks for your replay

dekwan
Cisco Employee
Cisco Employee

Hi,

The only statistics available in Finesse is with UCCE only. It is via the Queue object. Users are automatically subscribed to the queue node so an explicit subscription is not needed.

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:

Recognize Your Peers