Create Azure Bot Service

Open Visual Studio and select File, then New, then Project Choose Template Echo Bot

image001

In the New Project dialog, select the Bot Builder Template, name the project StockBot and click OKThe project will be created as below.

image003

Open StockBot.cs and refer OnTurnAsync method. This method will be called whenever the end-user communicates with the BotService

 

image004

The Stock Bot will ask user to enter the Ticker of Stock to show the stock details. To achieve it add a Service call to get the Stock details. For this example I have created a Web API Service using ASP.NET Core 2.2 and hosted in Azure. The below code will consume the Service and return the Stock Details for the Ticker. How to create a WebAPI and Host in Azure will be provided in a different DIY article in my Blog.

image006

Make the below change to OnTaskAsync Method. This will prompt the user to enter the Ticket of Stock

image008

Test the StockBot locally using Emulator. If not installed Bot Framework Emulator v4 (latest version available as of now!)

image010

Open the Emulator and choose the StockBot.bot file from the Project folder path as showed below.

image011

Open the StockBot.bot file.

image013

Leave the Microsoft App Id and Microsoft App Password blank and click Connect. The Emulator will show a screen as showed below.

image014

Enter the Ticker of your stock. Eg: AAPL

image016

StockBot prompts user to enter next TickerFurther you can enter multiple Ticker to test the Bot service.

image018

What’s Next? Deploy StockBot to Azure and integrate to Website and Skype.

 

Advertisements

Technical Lead for Microsoft Technologies especially in Azure, ASP.Net and in Angular JS.

Posted in Azure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s