Skip to content

Commit

Permalink
ChannelData - move defaultDialog to bot constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
pcostantini committed Feb 25, 2017
1 parent 1a1e415 commit 5681fda
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 32 deletions.
4 changes: 4 additions & 0 deletions Node/core-ChannelData/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Bot Framework Credentials

MICROSOFT_APP_ID=
MICROSOFT_APP_PASSWORD=
27 changes: 0 additions & 27 deletions Node/core-ChannelData/.vscode/launch.json

This file was deleted.

11 changes: 6 additions & 5 deletions Node/core-ChannelData/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This loads the environment variables from the .env file
require('dotenv-extended').load();

var builder = require('botbuilder');
var restify = require('restify');

Expand All @@ -7,18 +10,16 @@ server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});

// Create chat bot
// Create connector and listen for messages
var connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
var bot = new builder.UniversalBot(connector);
server.post('/api/messages', connector.listen());

var FacebookDataModels = require('./facebook-channeldata');

// Root dialog
bot.dialog('/', function (session) {
var bot = new builder.UniversalBot(connector, function (session) {

session.send('Looking into your upcoming flights to see if you can check-in on any of those...');

Expand Down Expand Up @@ -53,7 +54,7 @@ bot.dialog('/', function (session) {
]);

// The previous object construct will be serialized to JSON when passed as an attachment.
// The same result can be achieved using the following JSON notation:
// The same result can be achieved using the following in JSON notation:
// var checkin = {
// "type": "template",
// "payload": {
Expand Down
1 change: 1 addition & 0 deletions Node/core-ChannelData/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"dependencies": {
"botbuilder": "^3.6.0",
"dotenv-extended": "^1.0.4",
"restify": "^4.3.0"
}
}

0 comments on commit 5681fda

Please sign in to comment.