HELP!

Viabl.ai Genesys Integration

Integration with the Genesys contact centre API is achieved with the viabl.ai build tools. All API calls must be validated via an access token. This access token is obtained as the result from the Genesys API Authentication build tool. Once Genesys has validate the authentication request, the returned token is simply passed along with any subsequent Genesys API calls.

Build Tool: Genesys API Authentication

The API authentication build tool takes the client id and client secret which are a result of adding a Genesys OAuth client. See this Genesys help page for more information on this procedure.

Once the client ID and secret has been authenticated (along with the domain name of Genesys location), the Text Object created by the build tool will hold the access token used in subsequent API calls.

n.b. If the authentication fails for any reason, the viabl object will remain empty. This situation should be handled by your Knowledge-Base logic!

Build Tool: Genesys API Call

The API request build tool takes the access token held in the object created by the Genesys API authentication build tool and passes it along to a specific Genesys API end point.

The resulting viabl.ai JavaScript procedure allows the viabl developer to pass an optional HTTP body message along. The result from the API call is able to be interrogated and acted upon towards the bottom of the script.

Comprehensive documentation on the Genesys API can be found here.

Example API Call Procedure

let conv_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
let settings = {
    "api_uri": "api.euw2.pure.cloud",
    "path": "/api/v2/conversations/emails/" + conv_id + "/messages",
    "body": {
        pageSize: 100
    }
};
settings.access_token = #gat.val();
let r = #lib_Genesys_API.run(settings);
if (r) {
    // the emails are held in the entities array...
    for (let c = 0; c < r.entities.length; c++) {
        // populate the "Subject_Array" viabl object with the subjects of the emails in this conversation
        #Subject_Array.elementVal(c + 1, 1, r.entities[c].subject);
    }
} else {
    xpertrule.terminate("Error calling API");
}

In the above example, it is assumed that the viabl Genesys_Access_Token object has been created (and run prior to this script) via the API Authentication build tool.

We're making a call to retrieve all the email (headers) associated with a specific conversation. See this link for more details on the specific Genesys API call.

If the API call is a success, the resulting entities array is used to populate the Subject_Array viabl array object.

On This Page