Server scripts

Go to Content > Knowledge > Advanced > Server scripts

Here you can add javascript functions that can be used when configuring a knowledge, as for example.

In server scripts, you can add elements to retrieve information from the server: getHostType, getHostName, getServerType.


The console object is used to feed the logs present in the BMS console page for the different log levels

function logs() {
    console.debug("un message debug");"un message info");
    console.warn("un message warn");
    console.error("un message error");            


To trigger the call to an API from a server script, you must use the following syntax.

For the moment this needs to be framed in a JSON.parse(), but this will no longer be necessary later.

var result = JSON.parse(callApi.process(apiName, params));

with apiName containing the name of the defined web service and params containing a JSON object containing a mapping between the keys used by the web service and the values ​​to use. Example params below :

    'capture.latitude': latitude,
    'capture.longitude': longitude,
    'capture.zoom': '2'


The server script can read variables from the current conversation via the capture object. For example to know the caller's number for the callbot this can be done as in the example below:

function logNumero() {'Appel reçu du numéro ' + capture.callbot_client_phone);


The dialog object will eventually allow more information to be retrieved, but for the moment it allows you to retrieve the name of the consultation space currently used in the conversation

function logSpace() {
    var space = dialog.currentConsultationSpace();'espace en cours ' + space);

Last updated

Tous droits réservés @ 2023 dydu.