-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnectorSetup.js
More file actions
executable file
·23 lines (20 loc) · 964 Bytes
/
connectorSetup.js
File metadata and controls
executable file
·23 lines (20 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module.exports = function() {
var restify = require('restify');
global.builder = require('botbuilder');
var connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID ? process.env.MICROSOFT_APP_ID : '863a1c9b-9897-403f-a8aa-e3fd8329b87d',
appPassword: process.env.MICROSOFT_APP_PASSWORD ? process.env.MICROSOFT_APP_PASSWORD : 'pggMyZwYqYgewJbOTkEWHvW',
gzipData: true
});
global.bot = new builder.UniversalBot(connector, function (session) {
session.send('Non ho capito.');
});
// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});
server.post('/api/messages', connector.listen());
bot.use(builder.Middleware.dialogVersion({ version: 0.2, resetCommand: /^reset/i }));
bot.set('persistConversationData', true);
}