Azure Bot Service provides an integrated environment that is purpose-built for bot development, enabling you to build, connect, test, deploy, and manage intelligent bots.
In this tutorial, you will learn the following:
- Create Bot using VS2017 (Bot Framework SDK V4 template)
- Launch Emulator to run and test the Bot locally
- Create Azure Bot using Azure Bot Services
- Deploy and test the Bot at Web Chat
Below are the prerequisites:
- Visual Studio 2017 or later version
- Bot Framework Emulator for SDK V4
- Bot Framework SDK V4 Template for C#
Step 1 - Create Bot using VS2017 (Bot framework SDK V4 template)
- Launch Visual Studio 2017, create a new project, and select the Bot Framework.
- Select the Echo Bot (Bot Framework V4) template.
- Select the location and give the bot name.
- Click OK to create the project.
- The project consists of all necessary code to get started with a quick bot. Expand the solution followed by the Bot folder. Click on the EchoBot.cs file.
EchoBot.cs file consists of two main methods.
- OnMessageActivityAsync -> Invoke with every new message
- OnMembersAddedAsync -> invoke first time to add to any channel
Step 2 - Launch Emulator to run and test the Bot locally
As you connect with Bot Framework Emulator.
- A welcome message will appear at the initial stage, i.e., “Hello and Welcome”.
- Type the message “How r u “. You will get back the echo with the same message.
So, a simple echo bot is created and tested locally using Bot Framework V4.
Step 3 - Create an Azure Bot using Azure Bot Services
Log into the Azure portal.
Navigate to Azure Bot Service blade.
- Set all the required information.
- Name
- Subscription
- Resource Group
- Location
- Pricing
- App Name
- Select the Bot Template, i.e., Echo Bot (C#).
- Click OK to select the template.
- Click "Create" to the Azure Bot Service and deploy the bot to the cloud.
Navigate to the App Service Setting to get the Publish profile.
- Select "All App Service Settings".
- Select "Overview".
- Click on "Get Publish Profile" to download.
Step 4 - Deploy and test the Bot at Web Chat
- Navigate and right-click on Visual Studio Project solution.
- Select "Build" and then publish it.
- As you are doing the first time, the profile is not selected till yet. Click the Start
- Browse the downloaded profile and click the Publish button.
- The solution will get deployed to the cloud.
Now that your bot is created, test it in Web Chat.
Test the bot
In the Bot Management section, click Test in Web Chat. The Azure Bot Service will load the Web Chat control and connect to your bot.
I hope you have enjoyed and learned something new in this article. Thanks for reading and stay tuned for the next article.
Thanks for this. Please increase the resolution of screenshots.
ReplyDelete