-
-
Save kiramishima/f1466bebaaf4dddbba9667452317e481 to your computer and use it in GitHub Desktop.
Bot Framework Basic Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MICROSOFT_APP_NAME=<Nombre de Tu Bot> | |
MICROSOFT_APP_ID=<Tu App Id> | |
MICROSOFT_APP_PASSWORD=<Tu App Password> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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