https://github.com/skoif/Yandex-Dialogs
This is Node.JS SDK for yandex dialogs built with Express.
https://github.com/skoif/Yandex-Dialogs
Last synced: 2 months ago
JSON representation
This is Node.JS SDK for yandex dialogs built with Express.
- Host: GitHub
- URL: https://github.com/skoif/Yandex-Dialogs
- Owner: skoif
- License: gpl-3.0
- Created: 2018-06-03T22:19:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-11T14:39:30.000Z (almost 7 years ago)
- Last Synced: 2025-01-09T07:39:38.159Z (5 months ago)
- Language: JavaScript
- Size: 33.2 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-alice - skoif/Yandex-Dialogs
README
[](https://badge.fury.io/js/yandex-dialogs)
# Yandex Dialogs SDK [BETA]
This is something like express, but for Yandex Dialogs.
This is community library, not official.
## Installation
Install from NPM
```
npm install yandex-dialogs
```
Install from GIT
```
npm install https://github.com/skoif/Yandex-Dialogs
```
## Usage
```javascript
const Dialog = require("yandex-dialogs");
const dialog = new Dialog({port: 3000, url: "/alice", default_response: "Я вас не понимаю"});
dialog.bind("Привет", (req,res)=>{
res.send("Приветствую!");
});
```
## Dialog constructor parameters
```
new Dialog({[port], [url], [default_response]});
```
Port - web port, default: 3000\
Url - app's url, default: /\
Default response - response to send if no binds found, default: К сожалению, я вас не понимаю
## Bind
This function binds event for command
```
dialog.bind([command (or array of commands)], [callback]);
```
## BindOriginal
This function binds event for original_utterance
```
dialog.bindOriginal([original_utterance (or array)], [callback]);
```
## Bind's callbacks
```
([Request data],[Response object])=>{
res.send([text], [tss], [buttons], [end_session]);
}
```
Check official docs at https://tech.yandex.ru/dialogs/alice/doc/protocol-docpage/ To understand what is Request data, text, tss, buttons and end_session
# Disclaimer
This is not official Yandex's library.
Lib version: 0.3.0
Readme for version: 0.3.0