Deploying a bot with the Microsoft Bot Framework

Introduction

So far in my posts/videos on the bot framework we have been using the emulator to communicate with our bot. To finish off the basic tutorials for the bots we are now going to connect our bot to another channel, in this case Slack.

Connector Service

The Bot Framework’s Connector Service allows us to easily integrate our bots with various applications. To do this we need to register out bot on the Bot Framework site. In this post we will just be setting up our bot for dev purposes so wont worry too much about Icons and site details for help etc.

The first thing we need to do is host our application somewhere. I am just using a basic Azure App for this. We will need the endpoint details shortly when we register our bot.
Azure Publish
When you register a new bot you need to give it a name and handle. I am just going to use the same for both here.
Capture1
Next we configure the endpoint ensuring to add api/messages on the end. For the App ID and password press the button and you will be taken to another window to access/generate these.
Capture4
Bot ID and PW
One important note when generating the password is that you will not be able to access that again. If you don’t save the password immediately in your bot you will need to regenerate a new password.

Just like many app stores you will need to provide some details on the publisher such as support details and terms of use. These are important when you are pushing out a live application, for development purposes we just need to ensure they are in the valid formats.
Publisher Profile
If you intend to use App Insights then you can configure this at the end of the form. Then all that remains is confirming you have read the terms and privacy and then press Register. Capture7
You will now be navigated to your apps page. You will notice that the channels for Skype and Web Chat are already enabled. You don’t need to press the Publish button when working in Dev so this can be left for now. You can press the Test button on the right of the page to confirm connectivity to your published bot.
Capture8

Slack

When you have registered your bot you will be able to see a list of available channels. Each one has different configuration steps based on their own systems requirements. We are going to go through using Slack for this demo. Slack is a great chat application that works great if you need to section people into teams.  Capture9To publish your bot to Slack you need to setup a Slack account so you can administer your team and also have an account in api.slack.com which will allow you to develop Slack applications.
Capture10
When you choose to connect to a Channel you follow a basic set of instructions from the bot framework site. These are usually just steps on what to do in the other application. For Slack you are asked to create a new App which is what we do here.
Capture11The bot framework wizard shows you what information you need to input into Slack. So in our case we need to copy the redirect uri into the appropriate part of the Slack configuration form. Capture12Once we have done this we need to create a bot user, this is the handle we are going to use to invite and call our bot .
Capture14The next step is to copy the App Credentials into the appropriate boxes in the form on the bot framework site. When you authorise the bot, you will be prompted by Slack to confirm that you are happy for the bot framework to make these changes.
Capture18Capture19You will now be able to use your invite your bot into your group on slack and ask it your normal questions. In slack all bots are considered non-sentient users, so they respond to you but don’t initialise conversations.
Capture20Capture21
We now can test this by asking a couple of our bot questions.
Capture22One problem we encounter is that if you have prompts, you need to configure slack to allow interactive messages.
Capture23
If we go back to our app in api.slack.com we can enable interactive messages.
Capture24 We can now run our commands which contain prompts without problem.
Capture25
What next?

I see this as the last of the basic tutorials for the bot framework, we can now build bots using dialogs, LUIS, prompts and publish them to a channel. You can experiment with other channels and the process is quite straight forward for each of them.

Author: Dave Green

Software developer focusing on Microsoft Technologies, MCSD in Windows Store Apps, full time developer at a real job, part time writer and terrible golf player. Follow on twitter @IntelligentLabs

Leave a Reply

Your email address will not be published. Required fields are marked *