ck-dialogflow is separate module that connects to the widget. It is used to describe scripts and dialog rules.
For install ck-dialogflow
enter next command:
npm i ck-dialogflow
For quick start ck-dialogflow
enter next command:
import ckModuleInit from 'ck-dialogflow'
const DialogflowModule = ckDialogflowInit(dialogflowConfig)
Configuration file includes:
const rasaConfig = {
info: {
projectId: string
sessionId: string
}
api?: {
infApiUrl: string,
},
events?: {
ready?: string,
},
moduleEvents?: ModuleEvents
uiEvents?: UiEventsList
}
moduleEvents?: {
chatInit: (module: DialogflowModule, data: ChatInitData) => void
chatRequest: (module: DialogflowModule, data: ChatRequestData) => void
chatEvent: (module: DialogflowModule, data: ChatEventData) => void
setInfo: (module: DialogflowModule, data: SetInfoData) => void
reset: (module: DialogflowModule, data: ResetData) => void
},
uiEvents?: {
sendMessage: (data: SendMessageData) => void
uiManagment: (uiManagmentEvent: uiManagmentEvents, data: UIManagmentData) => void
notifications: (notificationsEvent: NotificationsEvents, data: NotificationsData) => void
modules: (modulesEvent: ModulesEvents, data: ModulesData) => void
}
}
ck-dialogflow
has next API methods:
API method | |
---|---|
chatInit | Dialog Initialization |
chatRequest | Sending user messages |
chatEvent | Chat events |
setInfo | Settings information |
reset | Reset dialogue |
moduleDispatcher
- method of event management.
moduleDispatcher
select method and transmits necessary data to it.
For example:
import moduleInit from 'ck-dialogflow'
const ckDialogflow = moduleInit(dlConfig)
ckDialogflow.moduleDispatcher('chatInit', { clientConfig: { siteLang: 'ru' } })