Skip to content

Instantly share code, notes, and snippets.

@kiramishima
Last active June 7, 2017 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiramishima/f1466bebaaf4dddbba9667452317e481 to your computer and use it in GitHub Desktop.
Save kiramishima/f1466bebaaf4dddbba9667452317e481 to your computer and use it in GitHub Desktop.
Bot Framework Basic Template
MICROSOFT_APP_NAME=<Nombre de Tu Bot>
MICROSOFT_APP_ID=<Tu App Id>
MICROSOFT_APP_PASSWORD=<Tu App Password>
require('dotenv').config()
var restify = require('restify');
var builder = require('botbuilder');
// 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: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
// Listen for messages from users
server.post('/api/messages', connector.listen());
// Receive messages from the user and respond by echoing each message back (prefixed with 'You said:')
var bot = new builder.UniversalBot(connector, function (session) {
session.send("You said: %s", session.message.text);
});
npm install dotenv botbuilder restify --save
touch app.js
vim app.js
Copy & Paste app.js to app.js (loool) and Save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment