Manjunath S
Manjunath S

Reputation: 43

Deploy a microsoft bot onto a local machine and host it

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?

Upvotes: 2

Views: 1988

Answers (1)

Javier Capello
Javier Capello

Reputation: 744

Here's a good place to start!

You need to do the following

  1. Install Restify

    npm install --save restify
    
  2. 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);
    });
    
  3. Run your bot with

    node app.js
    
  4. 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

Upvotes: 2

Related Questions