Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building Bots with Microsoft Bot Framework

You're reading from   Building Bots with Microsoft Bot Framework Creating intelligent conversational interfaces

Arrow left icon
Product type Paperback
Published in May 2017
Publisher Packt
ISBN-13 9781786463104
Length 424 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Kishore Gaddam Kishore Gaddam
Author Profile Icon Kishore Gaddam
Kishore Gaddam
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Setting up Microsoft Bot Framework Dev Environment FREE CHAPTER 2. Developing Your First Bot Using the Connector and Builder SDK 3. Developing WeatherBot Using Dialogs and LUIS 4. Natural Speech and Intent Processing Bot Using Microsoft Cognitive Services 5. Developing Bots Using LUIS Prompt Dialogs with State and Nearby Bot Using Custom APIs 6. Developing an IVR Bot for a Bank Using Advanced Microsoft Bot Framework Technologies 7. Intelligent Bots with Microsoft Bot Framework and Service Fabric 8. Developing Intelligent Facial Expression Identification Bot for IoT Using Azure and Power BI 9. Publishing a Bot to Skype, Slack, Facebook, and the GroupMe Channel

Calling LUIS from the bot

To incorporate a call to LUIS, we can start by adding this function. It simply calls LUIS and returns the city, state, or country names if the message is a weather query mentioning state and country.

Create a method in the WeatherDialog.cs class as follows; we will call this method from the MessageReceivedAsync method by passing the sentence asked by the user to your bot:

private static async Task<string> IdentifyCityUsingLUIS(string message) 
{
}

Now do a GET request to your LUIS app using the LUIS URL, which you saved in an earlier step, as follows:

var responseInString = await httpClient.GetStringAsync(@"REPLACE_WITH_YOUR_URL_HERE&q=" 
+ System.Uri.EscapeDataString(message));
dynamic response = JObject.Parse(responseInString);

Once you get a response from LUIS, try to parse it and identify whether the sentence contains the required Intent...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime