Conversational Components
- Introduction
- Component Structure
- Using Conversational Components
- Developing Conversational Components
Introduction
The idea behind Conversational Components is to provide solutions for recurring problems you might encounter while creating voice apps.
They are pre-built npm packages containing the necessary language model, handler (logic) and i18n (cms) files, which you utilize by delegating the task to the component.
Component Structure
Each component has the following structure:
The models
folder contains the language model, the src
folder contains the logic and the i18n
folder contains the components responses.
handler
The component's handler contains the states/intents to fulfill the incoming request. It has to have a START
intent which is the entry point for the component.
config
Every component has its own default configuration, which can be overwritten by the developer.
They provide you with a way to customize them without having to go through the handler and modifying stuff there. The possible options should be documented in each component's own README file.
i18n
The i18n folder contains the component's responses. Again, it's a way for the developer to customize the component, without having to dig through the handler.
The sample dialogs in the component's README file, should give you the necessary information you need to make changes to the responses.
For now, i18n is the only supported CMS, with other external ones planned.
index
The index.ts
file at the root is the entry point of each component. It exports a class which contains references to the handler and config object as well as the path to the i18n folder. The component's handler has to be nested inside a state named after the component itself to prevent intents from being overwritten. It also has a name
property which has to be the same as the package name.
Name | Description | Value | Required |
---|---|---|---|
name |
Name of your component. Has to be the same as the package name | string |
Yes |
handler |
Contains the logic of your component, i.e. states & intents | object |
Yes |
config |
Contains the default configuration | object |
Yes |
pathToI18n |
Specifies the path to your i18n folder containing the responses used in your component | string |
Yes |
That's the basic structure of a component.
Using Conversational Components
Learn how to integrate existing Conversational Components into your Jovo project here.
Developing Conversational Components
Learn how to develop your own Conversational Components here.