I have built a bot using microsoft botframework and nodejs. Now, I want to deploy it to a local machine and later host it and get the https url. I understood that it should be running on IIS but i don't understand where to start first. Can anyone help me to deploy it onto a local machine and how to host it?
1 Answers
2
votes
You need to do the following
Install Restify
npm install --save restify
Set up your app to use Restify, here's a sample code:
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.MicrosoftAppId, appPassword: process.env.MicrosoftAppPassword }); // 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); });
Run your bot with
node app.js
Download an open the BotFramework Emulator and set it to point to uri in which your bot is hosted, i.e.: http://localhost:3980/api/messages