Skip to content

Instantly share code, notes, and snippets.

@nwhitmont
Created August 9, 2017 22:19
Show Gist options
  • Save nwhitmont/548a41480340ed394338cfefc7957062 to your computer and use it in GitHub Desktop.
Save nwhitmont/548a41480340ed394338cfefc7957062 to your computer and use it in GitHub Desktop.
var restify = require('restify');
var builder = require('botbuilder');
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 the chat connector for communicating with the Bot Framework Service
var connector = new builder.ChatConnector({appId: process.env.APP_ID, appPassword: process.env.APP_PASSWORD});
// Listen for messages from users
server.post('/api/messages', connector.listen());
// Create your bot with a function to receive messages from the user
var bot = new builder.UniversalBot(connector);
bot.dialog('/', [
function (session) {
session.send('Bonjor! I am bot.');
builder.Prompts.text(session, 'What is your name?')
},
function (session, result) {
console.log(session.message.text);
session.send(`Nice to meet you ${session.message.text}`);
session.endDialog('Goodbye!');
console.log('Termine');
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment