Tvshow Bot Sample

This chat bot for Tv show information.This bot gives information of tv show like schedule,Rating,url. This also gives Tv show name by using Show id. If we give Show name Then It gives information of that particular Tv show. For example We give “Give information of Kumkum bhagya”. Then chat bot will display Herocard.By using that we can search show “Kumkum bhagya.” If we want show name of particular id.Then we can write “Give show of id 9” Then It will give show name of id 9. If we ask Rating of any show then it will display Average and Weight of show.If we want to know schedule of show then we can give input as “Give schedule of Kumkum bhagya”.Chatbot will give schedule of “kumkum bhagya”

Prerequisites

The minimum prerequisites to run this sample are:

  • The latest update of Visual Studio 2015. You can download the community version here for free.
  • The Bot Framework Emulator. To install the Bot Framework Emulator, download it from here. Please refer to this documentation article to know more about the Bot Framework Emulator.

LUIS Application

The first step to using LUIS is to create or import an application. Go to the home page, www.luis.ai, and log in. After creating your LUIS account you'll be able to Import an Existing Application where can you can select a local copy of the LuisBot.json file an import it.

Import an Existing Application

If you want to test this sample, you have to import the pre-build LuisBot.json file to your LUIS account.

Once you imported the application you'll need to "train" the model (Training) before you can "Publish" the model in an HTTP endpoint. For more information, take a look at Publishing a Model.

Finally, edit the RootLuisDialog.cs file and update the LuisModel attribute placeholders with the values corresponding to your Subscription and Application.

    ...
    using Microsoft.Bot.Builder.Luis.Models;
    using Microsoft.Bot.Connector;

    [LuisModel("YourModelId", "YourSubscriptionKey")]
    public class RootLuisDialog : LuisDialog<object>
    {
    ...

Where to find the Application ID and Subscription Key

You'll need these two values to configure the LuisDialog through the LuisModel attribute:

  1. Application ID

    In the LUIS application's dashboard, you can copy the App ID from the address bar.

    App Settings

  2. Subscription Key

    Once your app is published, copy the subscription key from the application resources on the Publish App page.

    Programmatic API Key

Code Highlights

One of the key problems in human-computer interactions is the ability of the computer to understand what a person wants, and to find the pieces of information that are relevant to their intent. In the LUIS application, you will bundle together the intents and entities that are important to your task. Read more about Planning an Application in the LUIS Help Docs. Check out the use of LuisIntent attributes decorating RootLuisDialog methods to handle LUIS Intents, for instance [LuisIntent("show_name")].

[LuisIntent("Show_name")]
public async Task Search(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
{
    ...
}

Each intent handler method accepts the IDialogContext, the original incoming IMessageActivity message and the LuisResult including the matching Intents and Entities for the LUIS query. In the sample below, the RootLuisDialog class retrieves a city value from the processed pre-built entity.

EntityRecommendation cityEntityRecommendation;

 if (result.TryFindEntity(Entityshowname, out showEntityRecommendation))
{
    cityEntityRecommendation.Type = "showname";
}

You might notice the use of EntityRecommendation.Type = "showname" in the code above. This is useful to map entity values to properties when reusing the LUIS captured entities for the FormDialog<HotelsQuery>. The properties mapped to entities will be pre-populated. In the case of the AirportCode this extra step is not required since the entity name already matches the property name.

var hotelsFormDialog = new FormDialog<HotelsQuery>(hotelsQuery, this.BuildHotelsForm, FormOptions.PromptInStart, result.Entities);

Outcome

You will see the following in the Bot Framework Emulator when opening and running the sample solution.

Sample Outcome

More Information

To get more information about how to get started in Bot Builder for .NET and Conversations please review the following resources:

Limitations
The functionality provided by the Bot Framework Activity can be used across many channels. Moreover, some special channel features can be unleashed using the ChannelData property.

The Bot Framework does its best to support the reuse of your Bot in as many channels as you want. However, due to the very nature of some of these channels, some features are not fully portable.

The features used in this sample are fully supported in the following channels:

  • Skype
  • Facebook
  • Microsoft Teams
  • DirectLine
  • WebChat
  • Slack
  • GroupMe

They are also supported, with some limitations, in the following channels:

  • Kik
  • Email

On the other hand, they are not supported and the sample won't work as expected in the following channels:

  • Telegram
  • SMS

Tvshow-chatbot