This is something like express, but for Yandex Dialogs. This is community library, not official.
Install from NPM
npm install yandex-dialogs
Install from GIT
npm install https://github.com/skoif/Yandex-Dialogs
const Dialog = require("yandex-dialogs");
const dialog = new Dialog({port: 3000, url: "/alice", default_response: "Я вас не понимаю"});
dialog.bind("Привет", (req,res)=>{
res.send("Приветствую!");
});
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: К сожалению, я вас не понимаю
This function binds event for command
dialog.bind([command (or array of commands)], [callback]);
This function binds event for original_utterance
dialog.bindOriginal([original_utterance (or array)], [callback]);
([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
This is not official Yandex's library.
Lib version: 0.3.0
Readme for version: 0.3.0