curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs sudo apt-get install -y build-essential
arch
botframework-emulator-3.5.29-x86_64.AppImage
Ctrl-`
. We recruit a team to create a new project: npm init
Enter
several times then yes
. Now install the 2 packages node.js: botbuilder and restify commands: npm install --save botbuilder npm install --save restify npm install --save dotenv-extended
// This loads the environment variables from the .env file require('dotenv-extended').load(); var restify = require('restify'); var builder = require('botbuilder'); // Setup Restify Server var server = restify.createServer(); server.listen(process.env.port || process.env.PORT || 3978, function () { console.log('%s listening to %s', server.name, server.url); }); // Create chat connector for communicating with the Bot Framework Service var connector = new builder.ChatConnector({ appId: process.env.MICROSOFT_APP_ID, appPassword: process.env.MICROSOFT_APP_PASSWORD }); // Listen for messages from users server.post('/api/messages', connector.listen()); // Receive messages from the user and respond by echoing each message back (prefixed with 'You said:') var bot = new builder.UniversalBot(connector, function (session) { session.send("You said: %s", session.message.text); });
node app.js
F5
. To set a breakpoint, move the cursor to the desired line and press - F9
. After launching the bot, we return to the emulator, connect to the address http://127.0.0.1:3978/api/messages
and type: Hi
and see the answer of our bot:Source: https://habr.com/ru/post/333824/
All Articles