Greetings.
Good people, who can explain in Russian what happens at the last stage of this scheme.
when the bot receives the message that the user sent it?
It depends on what you mean, in the picture it is the REST API authentication process, it does not process the messages, they are necessary for example in order to send a message to the chat (if you know its number)
In general, Bot's work for node.js looks like this (an example is almost from the documentation):
var restify = require('restify'); var builder = require('botbuilder'); 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 bot var connector = new builder.ChatConnector({ appId: process.env.MICROSOFT_APP_ID, appPassword: process.env.MICROSOFT_APP_PASSWORD }); var bot = new builder.UniversalBot(connector); server.post('/api/messages', connector.listen()); //========================================================= // Bots Dialogs //========================================================= //Обработаем команду / bot.dialog('/', function (session) { session.send('Твой ID'+ session.message.user.id); session.send('Твое Имя '+ session.message.user.name); console.log("Current message address",session.message.address); }); As far as I remember, the address is the path (chat id) that you can then use to send something in response via the REST API.
And session.send will respond to the chat immediately
Those. According to the ideas of Skepy developers, you can create route processing and automatically respond to user requests, for everything else, such as news alerts or something like that, you should use RestAPI
Source: https://ru.stackoverflow.com/questions/612235/
All Articles