-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
78 lines (61 loc) · 2.49 KB
/
app.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var restify = require('restify');
var builder = require('botbuilder');
var luis = require('./luis');
var createTicket = require('./dialogCreateTicket');
var helpDeskFlow = require('./dialogHelpDesk');
var getIncidentStatus = require('./dialog-get-status-number');
var helpdesk = require('./helpdesk/all');
var test = require('./dialogTest');
var kbSearch = require('./dialog-search-base');
var createIncident = require('./dialog-create-incident');
var laptopReplacement = require('./dialog-PCReplacement');
var diskSpace = require('./dialog-diskspace');
// 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: '1527db5b-d574-41ef-8652-6d102503a6f9',
appPassword: 'shPCO68!!aciehOYFO382{['
// appID: '',
// appPassword: ''
});
// Listen for messages from users
function respond(req, res, next) {
res.send('Everyone in IT needs a Dark-Knight');
next();
}
server.post('/api/messages', connector.listen());
// Serve a static web page
server.get(/.*/, respond);
// Create your bot with a function to receive messages from the user
var bot = new builder.UniversalBot(connector);
const LuisModelUrl = 'https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/061cfb89-c4af-471e-80bb-662d5d096d38?subscription-key=62ea92a6dad241628c1489c0333d166f&timezoneOffset=0&verbose=true&q=';
// Main dialog with LUIS
var recognizer = new builder.LuisRecognizer(LuisModelUrl);
var intents = new builder.IntentDialog({ recognizers: [recognizer] })
.onDefault((session) => {
session.send('**Sorry!** I did not understand \'%s\'.', session.message.text);
});
intents.matches('openTicket','/createTicket');
intents.matches('greeting','/greeting');
intents.matches('helpdesk','/helpDesk');
intents.matches('ticketStatus-Number','get-incident-info-number');
intents.matches('laptopReplacement','/PCReplacement');
intents.matches('diskSpace','/diskspace');
intents.matches(/\b(hubot||hubot|Hubot)\b/i, 'dialog-search-base');
intents.matches(/\b(tset|tedt|test|test)\b/i, '/test');
test(bot);
createTicket(bot);
helpDeskFlow(bot);
getIncidentStatus(bot);
kbSearch(bot);
createIncident(bot);
laptopReplacement(bot);
diskSpace(bot);
helpdesk.outlook(bot);
helpdesk.vpn(bot);
bot.dialog('/', intents);
bot.dialog('/greeting', require('./dialogGreeting'));