Configuration file
chatbot.yaml is the main configuration file of a chat bot. It contains the name of the script main file, information about linked modules, configuration of the NLU module, list of tests and other configuration data.
General settings
Bot name
name: botNameThis parameter is used to generate the name of a zip file when you run the build or buildDeploy command and the botId when you run deploy or buildDeploy.
Main file
entryPoint: main.scmain.sc or entryPoint.sc is the main file of the chat bot script from which the script starts to load. The file must be located in the src folder.
Other scripts and JS files can be loaded at the start of the script via the require tag.
Script XML tests
tests:
include:
- "**/*.xml"
exclude:
- broken.xmlYou can use script XML tests to verify chat bot logic by emulating client requests and verifying bot responses.
Any tests located in the test folder run automatically when you deploy your bot. You can override this behavior in the tests section.
The tests section can contain two subsections, include and exclude, each of them being the list of ant templates with file names.
include— only the tests from the files that match the templates listed in this section will be executed.exclude— all the files matching the templates listed in this section will be excluded from execution.
JS unit tests
jsTests:
extensions:
- spec.js
- test.js
include:
- "**/*.test.js"
- "dir/*.spec.js"
exclude:
- broken.test.js
- modules/common/**You can run JS unit tests on the platform to automatically verify whether your JS code is correct.
JS unit tests can only be executed locally. You can use the ZB-CLI maintenance utility for that.
The Jasmine framework is used to run the tests. All the files from the test folder with the test.js extension are run by default. You can refine your unit test inclusion rules in the chatbot.yaml file and specify extensions for files containing tests.
The jsTests section can contain two subsections, include and exclude, each of them being the list of ant templates with file names.
include— only the tests from the files that match the templates listed in this section will be executed.exclude— all the files matching the templates listed in this section will be excluded from execution.
You can override the extension for your test files in the extensions subsection.
Default bot language
language: ruUse the language parameter to specify your default bot language by filling the $request.language field (if it was not specified in the request).
The $request.language language will then be used to display localized error messages, and it can also be used in scripts.
Error messages
messages:
onError:
defaultMessage: Something has gone wrong
locales:
ru: Something has gone wrong
en: Failed on request processingYou can override your chat bot error message text in the message section. The text of the message is specified in the defaultMessage field.
If an error occurs and this field is not specified, the bot will not respond.
Localized message is selected depending on the client language given with the $request.language parameter. If the parameter is not given, the defaultMessage message is displayed.
Including dependencies
dependencies:
- name: common
type: git
url: https://<repository>
version: heads/master
- name: another_common
type: git
url: https://<repository>
version: heads/master
You can define the list of dependencies of your project in the dependencies section.
| Field | Possible values | Descriptions |
|---|---|---|
name |
<name> |
Name of the module to be used when you include files with the require statement. |
type |
git, module |
Dependency type. Here: git is an external git repository; module specifies the folder if the repository contains multiple modules. |
url |
http:// git:// file:// |
url address of the repository. For git dependencies only. |
version |
heads/master |
Dependency version; can specify the branch of the tag. For git dependencies only. |
?>Dependencies are downloaded to the module folder when you deploy via the web interface.
Injector
injector:
name: value
var1: value2Use the injector section to define configuration parameters of your chat bot. Parameters defined here will be available in chat bot scripts via the $injector variable.
NLU functions
Specify parameters for the platform’s nlp functions in order to enable an STS classifier. You can find detailed description of parameters and configuration file examples in this article.
Specify the following parameters in the chatbot.yaml file if you want to use the CAILA NLU service:
language: ru
botEngine: v2
sts:
noMatchThreshold: 0.2
caila:
noMatchThreshold: 0.2Learn more about the CAILA NLU service
File example
- Minimum configuration file:
name: echo-template
entryPoint:
- main.sc
tests:
include:
- test.xml- Configuration file of a project that uses the CAILA NLU service:
name: zb-cailapub
entryPoint:
- main.sc
botEngine: v2
language: ru
sts:
noMatchThreshold: 0.2
caila:
noMatchThreshold: 0.2- Configuration file of a project that uses the STS classifier:
name: content
entryPoint:
- main.sc
dependencies:
- name: common
type: git
url: https://bitbucket.org/common
version: heads/master
tests:
include:
- test.xml
- purchase_return.xml
- order.xml
- commercial.xml
- unsubscription.xml
nlp:
lengthLimit:
symbols: 1200
vocabFile: common-vocabulary.json
spellcheck:
enabled: true
minWordLengthForEditDistance: 3
maxWordEditDistance: 0
messages:
onError:
defaultMessage: Oops, something has gone wrong.
locales:
ru: Oops, something has gone wrong.