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 phrases identified by LUIS, such as name, city, company name, and so on.

Place your LUIS app endpoint URL, which you copied from the preceding step, in to the following variable in your code:

  var luisRequestURL =   "https://api.projectoxford.ai/luis/v1/application?id=  fbec04e7-8bda-4160-a059-a8f8b995184b&subscription-  key=ENTER_KEY_HERE"; 

Next, append the user message, which we get from the user to the luisRequestUrl and do a Get request:

   httpClient = new HttpClient();    HttpResponseMessage response = await     httpClient.GetAsync(luisRequestURL + "&q=" + messagetext);    string luisResponseString = await  response.Content.ReadAsStringAsync(); ...

Get Building Bots with Microsoft Bot Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.