-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
31 lines (26 loc) · 808 Bytes
/
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
var restify = require('restify');
var builder = require('botbuilder');
var server =restify.createServer();
server.listen(process.env.PORT || 1976,function()
{
console.log('% Listenting to %s',server.name,server.url);
console.log('APPID: %s',process.env.MY_APP_ID);
console.log('appsecret: %s',process.env.MY_APP_SECRET);
}
);
// Create chat bot
var connector = new builder.ChatConnector
(
// {appid: null,appsecret: null }
{appid: process.env.MY_APP_ID,appPassword: process.env.MY_APP_SECRET }
);
var bot = new builder.UniversalBot(connector);
server.get('/', restify.serveStatic({
directory: __dirname,
default: '/index.html'
}));
server.post('/api/messages', connector.listen());
bot.dialog('/',function(session)
{
session.send("You said: %s", session.message.text);
});