-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
32 lines (25 loc) · 939 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
32
var builder = require('botbuilder');
var restify = require('restify');
// 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 bot
var connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
// Listen for messages
server.post('/api/messages', connector.listen());
var bot = new builder.UniversalBot(connector, function (session) {
// Create and send attachment
var attachment = {
contentUrl: 'https://docs.botframework.com/en-us/images/faq-overview/botframework_overview_july.png',
contentType: 'image/png',
name: 'BotFrameworkOverview.png'
};
var msg = new builder.Message(session)
.addAttachment(attachment);
session.send(msg);
});