Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Hosted-services / Azure

Creating Bots with Azure Bot Service

4.80/5 (3 votes)
3 Jan 2017CPOL4 min read 21.9K  
Create your first Bot-as-a-Service with Microsoft Azure Bot Service!

The industry’s first cloud Bot-as-a-Service, Azure Bot Service is a platform that accelerates bot's development. It is an integrated environment that enables us to register, build, deploy and manage intelligent bots at once. In addition, you can easily integrate Microsoft Cognitive Services with bots to enhance user experience and interaction. The platform is powered by Microsoft Bot Framework and Azure Functions.

Image 1

Azure Bot Service vs Bot Framework Developer Portal

If you are familiar with bot development using Microsoft Bot Framework, you can be thinking about what are the differences between features provided by Azure Bot Service and Bot Framework Developer Portal.

Azure Bot Service is integrated with Azure environment and Microsoft Cognitive Services. It means that in a single platform, you can create a messaging endpoint, build, deploy and manage your bots.

On the other hand, Bot Framework Developer Portal doesn't have these integrations. You can integrate your bot with Azure and Microsoft Cognitive Services, but you need to do it manually. The advantage is that it lets you create messaging endpoint with any other cloud provider, not just Azure.

So depending on the scenario, you can implement your bot using Azure Bot Service or Bot Framework Developer Portal.

Creating a New Bot Service from Azure Portal

First of all, it is necessary to have an Azure Subscription. For more details, see How to sign up, purchase, upgrade or activate Azure.

Open the Azure Portal and sign in with your account. Then click on New [+] > Intelligence + analytics > Bot Service.

Image 2

Fill the required fields and then click on Create.

Image 3

When you create a Bot Service, basically you are creating an Azure Web app with additional features. If you go to App Services section, you can see the Bot Service app and some detailed information.

Image 4

Click on the Bot Service. Now you need to create a Microsoft App ID and a Microsoft App Password. To do this, click on Create Microsoft App ID and password.

Image 5

Enter with your Microsoft account and then click on Generate an app password to continue.

Image 6

A new password will be generated. Copy this password locally because you will need to paste it in the bot configuration file. Then, click on Finish and go back to Bot Framework. If you have lost or forgotten the password, you can generate a new password later.

Image 7

Back to the Azure Portal, paste your password.

Image 8

Now you need to choose the programming language that you intend to use.

Image 9

Choosing a Bot Template

If you have never created a bot with Bot Framework, you can create a Basic template to see how it works. The Form template shows how a bot can provide a custom form to users.

If you want to create a bot that triggers an event based on some actions, you can integrate it with Azure Functions using the Proactive template. Natural Language Processing (NLP) is extremely important for chat bots, so you can choose Language understanding template and it will integrate a bot with Language Understanding Intelligent Service (LUIS).

It is important to mention that is possible to merge these templates and add new features. For example, you can create a bot that uses NLP to have a natural interaction with users and triggers an event when a specific task is requested.

Select a bot template and click on Create bot.

Image 10

Then a new panel will open. In the first tab, on the left, you can see the code used for your application and on the right, you can see a web chat. Once you change the code of your bot, you can check these changes in the web chat. This is excellent to improve your productivity while developing the bot.

Image 11

Testing the Bot

If you created a Basic template, you can type any word or letter and the bot will echo back your input.

Image 12

After any change in the code, you can click on Save button and test it again in the web chat.

Image 13

Then go to the web chat and test it again.

Image 14

As you can see, it is working as expected!

Adding Channels

It is possible to add your bot to a lot of different channels, such as Skype, Microsoft Teams, Facebook Messenger and much more. To do it, click on the Channels tab and add your preferred channels.

Image 15

Bot Settings

If you click on Settings tab, you can add image, name and description for your bot.

Image 16

To download the source code and deploy it from an integrated environment, such as GitHub and Visual Studio Team Services, go to Continuous integration and click on Configure.

Image 17

For more information about the service, see the Azure Bot Service Overview.

In addition, if you want to know about best practices for UX when we are dealing with bots, you can read my eBook "UX Best Practices for Bot Applications" (http://aka.ms/ux-chatbots).

I hope you liked it. Embrace the Digital Transformation!

History

  • 3rd January, 2017: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)