This is a series of blog posts that will walk through the following:
These posts are based on the Preview Microsoft Teams Developer Platform.
You can build many different types of Bots , this particular post is based on a simple Q&A Bot. For more information on the different more complex types of Bots visit the Bot Framework Overview
Create and Publish your Q&A Service
For a Q&A bot we start with creating a service via navigating to QnA Maker , after signing in select the Create a Service link at the top of the page. We now need to give you service a name and decide how to load data.
As noted in the screen you can start via giving the service a Url of a FAQ to load, Upload a File containing question and answer pairs or just manually load. In this example select Create at the bottom of the page to create a blank KB.
To add some responses you can then use the Add new QnA Pair option and then select Save and Retrain to add the items you entered.
Next select the Test option on the left. This will allow you to test chatting to your Bot as well as adding alternative responses. With the default setup if you say Hi the Bot responds with Hello, but if you say Hello it will give the default no good match found. If you add some alternatives as shown below and then click save and retrain the Bot will now respond with Hello for those items as well.
This is a very basic example but it illustrates how this can be used to easily add a response for multiple alternative phrases. In some cases with more content loaded multiple responses may be matched hence the option on the left to choose the most appropriate response allows selection of the best one to use.
Finally if you want to load more content from a url or file the settings page can be used to add this. You can come back later and tweak the content , each time you do this you need to Save and retrain.
For now however just hit the publish option. After clicking through Publish you will see a a success screen and we now need to build our Bot
Build your Bot
Now we need to put the actual Bot on top of the knowledge base functionality. You can build and host your own and call the provided REST API via the url given to you on the success page of publishing your QnA service but fortunately there is a much easier way which involve writing no code yourself.
Navigate to Azure and hit the add button and search for Bot Framework.
The next screen will ask you to give your bot a unique name and pick which resource group and location to host it in. On this screen I highly recommend selecting the Pin to Dashboard option down the bottom , as this makes it far easier to find your service when you need to configure it.
This will then create your Bot Service. Now you need to configure it. Assuming you pinned it to your dashboard navigate to it from there , if you did not the easiest way I have found to get back to it is via the resource group.
It will be an app service and when you select it it will display a screen that is asking for an App ID.
To generate an App ID just hit the create button, at this point you may need to sign-in to the app registration portal. Just generate the ID and password using the options , but please pay attention when it warns you that the password will not be shown again after this screen so record it carefully !
Once that is generated that screen will close and the details will be added to the Bot screen in Azure. You also need to paste the app password in.
The next step is to select a language, I am using Node but C# is also available.
Down the bottom of the screen it also asks for you to select a template, in our case we want to use the Question and Answer template
After hitting the Create bot it will then give you an option to create to an existing knowledge base. You can also create a KB from this screen but I find training the KB can take a while so I prefer to do that first to make sure I am happy with it before I create my Bot.
You Bot will then be generated which typically takes a few minutes. The final step is to enable the Teams Channel for the Bot.
Configure Teams Channel and add to Teams
The next step is to navigate to the channels page and select add for Microsoft Teams.
On clicking add it will the configure the required settings so you can just click I’m done configuring Microsoft Teams.
As during the developer preview we side load bots we do not need to publish the bot hence we can just click the Test link to Add to Teams.
In teams you should now be able to chat to your bot.
Next post covers how to sideload the Bot and add a pinned Tab