Revision as of 12:35, May 27, 2015 by Jumunn (talk | contribs)
Jump to: navigation, search

Service Client API

This document proposes a new client service API to allows a IFRAME to access the WWE object model and to bypass the cross domain security limitation. When the third party web page is configured to display a new tab in the WWE user interface (described here: Support integration with third party web applications), for instance, this service API gives just an access to the dial operation. A sample can be found in the WWE repository: service-client-api.zip.

Working with the API

In order to use the API, you must include the wwe-service-client-api.js file in your web application. You can find this file in your Workspace Web Edition & Web Services installation package.

Once you add the JavaScript file, you can access the Service Client API genesys.wwe.service namespace. For example:

<html>
    <head>
        <script src="wwe-service-client-api.js"></script>       
        <script>
            function succeeded(result) { console.debug("SUCCEEDED, result: " + JSON.stringify(result, null, "\t")); }
 
            function failed(result) { console.debug("FAILED, result: " + JSON.stringify(result, null, "\t")); }
 
            function callMe() {
                genesys.wwe.service.voice.dial('+33298000000', succeeded, failed)	
            }
        </script>
    </head>
    <body>
        <a href="javascript:callMe()">Call me</a>
    </body>
</html>

Security

This API involves two parties inside the web browser of the agent. The service which is the main web page. And the client which takes place into an iframe in the same web page as the service.

Every options relative to these security sections are only applicable at the Application level and not on the Agent or Agent Group.

Origin

Because of the web browser security restriction, for this third party web page to access this API, the option "service-client-api.accepted-web-content-origins" must be configured in the section "interaction-workspace" of the Workspace Web Edition application. For instance, if you want to give the access to this web page located at the address: http://my-web-server/path/page.html

then, you can set:

service-client-api.accepted-web-content-origins=http://my-web-server

If several custom web pages must access the API, you can grant the access like the following:

service-client-api.accepted-web-content-origins=http://my-web-server, http://my-second-web-server, http://my-third-web-server

To allows any web pages to access the API, just set:

service-client-api.accepted-web-content-origins=*

Rate Limit

The option "service-client-api.rate-limit" specifies the limit for the maximum number of requests per minute on any service API call. I.e.: In the configuration:

service-client-api.rate-limit=50

means that globally, every requests are limited to 50 requests / minutes.

0 means unlimited.

When a limit is reached, further requests of the same type will be ignored for a certain period of time (the quarantine delay), and the first request receives a result with an explicit error message:

{
    "errorMessage": "The rate limit for the request 'voice.dial' has been reached.\nFurther requests of the same type will be ignored for 30 seconds.",
    "request": "agent.getState"
}

You can specify a global quarantine delay which is 30 seconds by default:

service-client-api.rate-limit-quarantine-delay=60

means that you need 60 seconds before being able to send a new request!

0 means that anymore requests will be ignored forever!

API Reference

Results Management

All the methods are asynchronous, so to get the succeeded or the failed result, just add the matching callback:

genesys.wwe.service.voice.dial('+33298000000', function(result){
    console.debug("SUCCEEDED, result: " + JSON.stringify(result, null, '\t'));
}, function(result){
    console.debug("FAILED, result: " + JSON.stringify(result, null, '\t'));
})

Sample of message received when an operation is succeeded:

{
	"request": "voice.dial",
	"data": {
		"statusCode": 0
	}
}

Sample of message received when the web application isn't authorized to use the API:

{
	"request": "voice.dial",
	"errorMessage": "The service API denied the access for the origin: http://localhost:8090\nPlease check the option 'service-client-api.accepted-web-content-origins'"
}

System Namespace

Methods

getAllowedServices

<static> getAllowedServices() → {Array.<string>}

Following the security configuration, this service retrieves the list of allowed services.

Returns: An array of allowed services array.

Type: Array.<string>

Voice Namespace

Methods

dial

<static> dial(destination, userData)

Call the destination like it is done from Team Communicator. It supports the Caller ID feature and the 'routing-based' mechanism from the intercommunication features.

Parameters:

Name Type Argument Description
destination string The call destination number.T
userData object <optional> The attached user data key/value object which is updated with each interaction event.
Comments or questions about this documentation? Contact us for support!