Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Create Your First Chatbot Using Azure Bot Services

DZone's Guide to

How to Create Your First Chatbot Using Azure Bot Services

Bots are intelligence programs that can mimic human behavior. They sound difficult to create — but the Azure Bot Service is super easy.

· Big Data Zone
Free Resource

Need to build an application around your data? Learn more about dataflow programming for rapid development and greater creativity. 

"Bot" is a popular buzz word nowadays. Everyone is talking about bot services. I've decided to explore this and provide you with 10 easy steps to create yourfirst chat Bot using Azure Bot Services.

So, let’s start by understanding what chatbots are. You can think of a chatbot as an intelligent program that interacts with human or users. It simulates conversations with human users.

As mentioned, it is an intelligent program that uses Machine Learning to understand patterns and respond accordingly. In a nutshell, we can say that it's an Artificial Intelligent program that uses Machine Learning to mimic human conversation.

Microsoft, Facebook, and other companies have come up their own chatbot framework.

In this example, we are talking about Microsoft Azure Bot Service, which is super easy. You can create chatbots and deploy and inject them with different sources such as Skype, your own site, Slack, Facebook, etc. However, in this post, we are only going to create a chatbot. Integration with other sources like Facebook and Slack is not part of this post, but we will this see in upcoming posts.

There is only one major prerequisite for creating your chatbot: having an Azure portal account.

Now, let’s create your first chatbot using Azure Bot Service.

1. Define Basic Information

There's a bot service option, which is currently in preview mode through the following actions:

App Services > Intelligence + analytics > Bot Service (Preview).

Indiandotnet_AzureBot

Once you click Bot Service (preview), you will get the following option where you have to define basic information like app name and location.

12. Create an App ID

Once you have created it, you will get the following screen where you need to create App ID. This  is a prerequisite to authenticating your bot with the bot framework.

2

When you click Create Microsoft App ID and password, you will get the following screen. You need to create a password and paste it in the below screen. To finish, click “Finish and go back to Bot Framework.

3

3. Choose Your Programming Language

You will see the below screen where you need to select your code language. I like C#.

4

Just below this language option, you have some other options, as shown in below screen, which is basically a template of your bot. You can select any template that makes sense and fulfills your objective. In this example, I have selected the Language understanding template.

5

4. Use LUIS to Teach Your Bot

The next interesting objective is to teach your bot through LUIS (Language Understanding Intelligence Service). LUIS helps teach the bot. You can log in using the AppID that we created earlier.

6

7

5. Manage the Bot's Application Model 

Once you have logged into LUIS, you will get the following screen with a dashboard from which you can manage your Chatbot application’s model:

10

The next step is to teach your model.

6. Teach Your Model

If you are not aware of LUIS currently, just understand that it is a teacher who teaches your bot. If you say “Hello,” then your intention is a greeting. This is how you teach your model. I will share a separate post for LUIS soon.

11

7. Train Your Model

You can train your Model by clicking Train in the left bottom corner. Once your training is done and you think it is working fine, then you can deploy or publish it. You can test its query parameter sas shown below.

12

8. Modify Your Bot

Once you are done with LUIS and come back to your Azure Bot service application, you can manage the C# code and modify it further for the different intents that you set in LUIS. For example, in above screen, you will find three intents:

  1. None.

  2. Location.

  3. Greetings.

Similarly, you can create multiple intents to make your chatbot robust. Here, if you see the code in Azure itself, you don’t need to worry anpit different settings for publishing and getting the code up and running.

9

9. Update Code to Match Intents

As we added different intents in our chat model, we need to update our C# code, as well. To add any intent, you need to modify BasicLuisDialog.csx, as highlighted in yellow below.

13

If you see the above image, you will find that we have added our two intents (greetings and locations) and written our custom logic.

We can test right away by entering the different statement in chat in right chat panel.

Once you are satisfied with your work, just publish it. I hope this is enough content for getting your hands on the Azure Bot Service for the firs time. I know you might face some challenges in LUIS, but trust me — it is super easy. Just try it. In any case, I am going to write another post for LUIS.

Please share your inputs what you think about this post and the Azure Bot Service.

Check out the Exaptive data application Studio. Technology agnostic. No glue code. Use what you know and rely on the community for what you don't. Try the community version.

Topics:
big data ,artificial intelligence ,tutorial ,chatbot ,azure bot service

Published at DZone with permission of Rajat Jaiswal, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}