Mixing Web API & JavaScript API Calls in Third-Party Finesse Gadget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2019 07:14 PM
JavaScript API lib is handy but not as comprehensive as its web API counterpart. Sometimes you end up using both. But the two do not seem to coordinate with each other well.
In JavaScript API, after you call
user.getDialogs({
onCollectionAdd : handleNewDialog,
onCollectionDelete : handleEndDialog
});
You would think anytime the user has a new dialog, your method of handleNewDialogs gets hit.
It is true if you do a user.makeCall to create a new dialog in JavaScript API.
But if you use web API of
<Dialog>
<requestedAction>MAKE_CALL</requestedAction>
<fromAddress>1001001</fromAddress>
<toAddress>1002002</toAddress>
</Dialog>
it does not. It takes a separate call to user.getDialogs to get the new dialog loaded.
We assume the Finesse client has full CTI event subscription for the logged-in user and receives all events via that default BOSH hub gadget. What does it take to have handleNewDialogs called when you have a new dialog created via web API call?
- Labels:
-
Finesse

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2019 03:55 PM
Hi,
@limingq2010 wrote:
You would think anytime the user has a new dialog, your method of handleNewDialogs gets hit.
It should. The handleNewDialog should be called no matter where the make call request is coming from. It should be called even if the agent picks up the hard phone and makes a call.
@limingq2010 wrote:
But if you use web API of
<Dialog>
<requestedAction>MAKE_CALL</requestedAction>
<fromAddress>1001001</fromAddress>
<toAddress>1002002</toAddress>
</Dialog>it does not. It takes a separate call to user.getDialogs to get the new dialog loaded.
I wasn't able to reproduce this. Using the LearningSampleGadget + the code from your browser close thread (https://community.cisco.com/t5/contact-center/recover-dialogs-after-browser-shutdown-using-javascript-api/m-p/3813527), I used postman to make a call via the REST API and I was able to see the call details on the dialog section of the gadget. Then I used the browser's debugger, breakpointed the handleNewDialog function, and made a call via the API and the breakpoint hit and I was in the handleNewDialog function.
There shouldn't be any difference between the JavaScript API and the REST API in terms of the notifications that Finesse sends via XMPP/BOSH. In reality, the JavaScript API is actually using the REST APIs underneath it so it should all be the same.
Thanx,
Denise
