# ck-dialogflow

> SOVA dialog module

Latest version **0.1.0** (published 2020-09-03) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install ck-dialogflow
pnpm add ck-dialogflow
yarn add ck-dialogflow
bun add ck-dialogflow
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2020-09-03 |
| First published | 2020-09-03 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 117.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 37 |
| Maintainers | sova-ai |
| Keywords | SOVA, chat-kit-module |

## Links

- npm: https://www.npmjs.com/package/ck-dialogflow
- Repository: https://github.com/sovaai/chatKit-dialogflow-module
- Homepage: https://sova.ai
- Issues: https://github.com/sovaai/chatKit-dialogflow-module/issues
- npm.io page: https://npm.io/package/ck-dialogflow

## Recent versions

- 0.1.0 (latest) — 2020-09-03

## README

**ck-dialogflow** is separate module that connects to the widget. It is used to describe scripts and dialog rules.

## Install
For install `ck-dialogflow` enter next command:
```javascript
npm i ck-dialogflow
```

## Quick start
For quick start `ck-dialogflow` enter next command:
```
import ckModuleInit from 'ck-dialogflow'
const DialogflowModule = ckDialogflowInit(dialogflowConfig) 
 ```
 

# Description
## Dialogflow config
Configuration file includes:   
```javascript
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
  }
}
 ```

## API methods
`ck-dialogflow` has next API methods:

| API method                                                                                                                              |                                  | 
|-----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------| 
| [chatInit](https://github.com/sovaai/chatKit-dialogflow-module/blob/master/docs/apimethods/chatInit.md "Read about this method")        | Dialog Initialization            |
| [chatRequest](https://github.com/sovaai/chatKit-dialogflow-module/blob/master/docs/apimethods/chatRequest.md "Read about this method")  | Sending user messages            |
| [chatEvent](https://github.com/sovaai/chatKit-dialogflow-module/blob/master/docs/apimethods/chatEvent.md "Read about this method")      | Chat events                      |
| [setInfo](https://github.com/sovaai/chatKit-dialogflow-module/blob/master/docs/apimethods/setInfo.md "Read about this method")          | Settings information             |
| [reset](https://github.com/sovaai/chatKit-dialogflow-module/blob/master/docs/apimethods/reset.md "Read about this method")              | Reset dialogue                   |


## Dialogflow.ModuleDispatcher
`moduleDispatcher` - method of event management.   
`moduleDispatcher` select method and transmits necessary data to it.  

For example: 
```javascript
import moduleInit from 'ck-dialogflow'   
const ckDialogflow = moduleInit(dlConfig)   
ckDialogflow.moduleDispatcher('chatInit', { clientConfig: { siteLang: 'ru' } })
```

---
_Source: https://npm.io/package/ck-dialogflow · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
