-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnectorSetup.js
More file actions
25 lines (21 loc) · 947 Bytes
/
connectorSetup.js
File metadata and controls
25 lines (21 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module.exports = function () {
global.restify = require('restify');
global.builder = require('botbuilder');
global.locationDialog = require('botbuilder-location');
// 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
});
global.bot = new builder.UniversalBot(connector);
global.bot.library(locationDialog.createLibrary(process.env.BING_MAPS_API_KEY));
// Setup Restify Server
var server = restify.createServer();
server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser());
server.listen(process.env.port || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});
server.post('/api/messages', connector.listen());
}