How to use Microsoft Bot Framework with Total.js?
Create a definition file e.g. bot.js
:
const BotBuilder = require('botbuilder');
var connector = new BotBuilder.ChatConnector({
appId: 'YOUR-APP-ID',
appPassword: 'YOUR-APP-PASSWORD'
});
var bot = new BotBuilder.UniversalBot(connector);
bot.dialog('/', function (session) {
session.send('Hello World');
});
// Register a middleware
F.middleware('connection', connector.listen());
Create a controller with a route with empty response:
exports.install = function() {
// Create route
F.route('/api/messages/', EMPTY, ['#connection', 'post']);
};
function EMPTY() {
this.empty();
}