Server scripts
Last updated
Last updated
Tous droits réservés @ 2023 dydu.
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
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.
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 :
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:
The dialog object allows us to retrieve a lot of information, among which we could find:
The name of the consultation space currently in use in the conversation:
The language used : dialog.language()
The current URL: dialog.userURL()
The user ID (IP adress, ..) : dialog.userIdentification()
The operating system (OS) used : dialog.userOs()
The browser used : dialog.userBrowser()
The different user queries: dialog.currentUserSentence()