Showing results for 
Search instead for 
Did you mean: 

Accessing Chat state with in Finesse

Level 1
Level 1

Hi. I am using Cisco Finesse (11.5) and ECE. I have configured a Finesse Gadget which dynamic depending on a call variable that is passed via the ECE chat using the the Media dialog/queue (<mediaId>5000</mediaId>).

I would like to further enrich the gadget to change depending on which chat is active. I can see from the console output of finesse that this data <state> is what i need to access and is send along with the mediaID500 in <mediaType>ECE_CHAT</mediaType>.

Am I correct in assuming that this mediaType (ECE_CHAT) is not available to the gadget and if so, is there any other way to access the state of the chat.

Iv included a sample dialog:





















                                               <value>John Doe</value>













































10 Replies 10

Cisco Employee
Cisco Employee

Hi Sylvester,

I am not familiar with the details/code of the Finesse Gadget for ECE. I am going to assume that this is the gadget that is written by eGain.

Since I am not familiar with the code for this gadget, I can't give you a 100% confidence answer as it is based off of assumption. If this is indeed the gadget written by eGain, I would reach out to them. But, based off of what I know about ECE and what you are seeing in the console output, the gadget is most likely using that event you provided above to populate the data. So the gadget should be already parsing that information and it should be a matter of extracting another tag to get the value.

Again, this is all based off of assumptions because I haven't actually seen the code for this gadget before. But it makes complete sense for the gadget to be using that event because that is the type of event for any email/chat interaction.



Thx for your reply Denise.

I was able to get access to the state with correct tags.

I have a further question - in relation to the onChange for mediaList.getMedia, What does this look out for in relation say to the above example. I have tried to use it with out success when there has been changes (in <state>ACTIVE</state>) for the same Dialog.



Hi Sylvester,

Again, I will have to put the caveat that I'm giving these suggestions blind as I don't have the actual code to the gadget.

Based off the way the voice dialogs work, I would think that if you want to add a handler for when the media object gets changed, you would need to add it to the media object itself.

So somewhere in the code, I assume that there is:

user.getMediaList( {

   onCollectionAdd: addHandler,

   onCollectionDelete: deleteHandler


In the addHandler function, it probably takes in a mediaDialog as a parameter. On THAT object, you want to add a change handler, similar to this:

mediaDialog.addHandler('change', _processMediaDialog);

I am extrapolating this suggestion based off the voice dialogs, but I believe that the mediaDialogs follow the same flow.



Level 1
Level 1


I have the same issue, I needed to get the call variables in ECE gadget. I can see console.log display all the information but I am not able to extract this information from ECE gadget (ece.js) file.

Can you help me with how you have access the call variables in the gadget because I have tried to use _dialog but its returning null values

any help is much appreciated.

Hi Malik,

Apologies for delay in replying, I was on vacation.

My initial question related to accessing a variable attached to an ECE message. Once I had the ECE configured correctly to handle the variable we were able to access it.

Does your question relate to the same.


Thanks @Sylvester
yes, I have more or less same question. Need to get ECC variable in ECE gadget.

Here is the complete scenario.

We have appended some customer field in "Client Side" form,  so as soon as customer provide that information, we set that information in the ECC variable. When the chat session starts we can see that ECC variable data is available in TCD.

Now we need to get those variable in the ECE gadget(which agent use).

I have expertise in voice gadget (getting data,ECC variable, call variables etc..) which work in the different events (call end event, start, user change etc).

But I am not able to get that event and  ECC variable in ECE Gadget.

Any help would be really appreciated.

ok, so if you have ECE configured correctly, the code I used went similar to the following basic version where the call variable we need to get was configured as callVariable8 on ECE.

mediaList = user.getMediaList( {



handleMediaListLoad = function (_mediaList) {

try {

media = _mediaList.getMedia({





  } catch ( error ) {




handleMediaLoad = function(_media) {

_MediaDialogs = _media.getMediaDialogs({

onCollectionAdd :_handleMediaDialogsAdd,

onCollectionDelete :_handleDialogDelete,

onLoad :_handleMediaDialogsLoaded



_handleMediaDialogsAdd = function(dialog) {

_dialogCollection = _MediaDialogs.getCollection();

if (_dialogCollection) {

getCallvars = _MediaDialogs.getData().Dialog.mediaProperties.callvariables.CallVariable;

varobj = getCallvars.filter(function (obj) { === 'callVariable8';


shortId = obj.value;

clientLogs.log('CallVariable8 : ' + obj.value);



_handleMediaDialogsLoaded was pretty much the same as _handleMediaDialogsAdd

on which file we will append this code, ece.js ??

I am not sure if you can add it to ece.js, you possibly could.

What I did was create a new file/gadget that was loaded via a URL on runtime.

We have added this code inside the ece.js but we are not receiving any chat event henceforth no ECC variables.

May I know how you have registered with chats event  (Chat initiate, chat receive etc )