Build a Flight Tracker ✈ with Bot Framework Composer 🤖 – Part 2

In our previous post, I talked about how can we create a simple Flight Tracker bot with the fixed Adaptive Cards information. In this post, we’re going to learn how can you handle interruptions during a bot’s conversation and what it takes to integrate the same bot with Azure Functions followed by the publishing to different channels with just point and click experience.

Handle Interruptions

People like to talk in a natural way and natural way is not always sequential. For example, during a fund transfer flow, people may change their mind and ask about their balance. Therefore, handling interruptions is an essential part of a robust bot.

Since there’s no right or wrong answer to this situation, I have listed down a few questions for you to consider while designing your experience.

  • Do you want to answer the user first?
  • Do you want to discard your previous context and start from the new one?
  • Should you resume from the previous discussion after answering this?

In our case, we just have Help Dialog but a production ready bot can have multiple dialogs where you may have to deal with frequent interruptions. As the Bot Framework Composer has encapsulated Adaptive Dialog system in itself, interruption handling has become much easier.

Having said that, we will just create another Trigger similar to what we created earlier (Track Flight) and name it as Help. So now if anyone writes *I want help* or the similar phrase, with the help of LUIS, we will know that it’s a help intent.

However, if you notice, I have defined a condition with the score which means that if the intent score has more than 50% of confidence in detection, only then this should be triggered.

 

Help Trigger

On the trigger of Help intent, we’re simply calling a HelpDialog where we will just define 3 responses in the LG editor so that they can be sent randomly to the user whenever the Help intent is triggered.

Help Dialog

Now, to turn on the interruptions in the middle of bot’s conversation, we have to go back to your TrackingDialog and set Allow Interruptions to true. What will happen then? Even if our bot is expecting an input such as source or destination, the bot will still handle responses from the user even if they are not related to the source / destination (i.e. they are related to help, see .GIF below).

This is how the experience will look like;

FlightTracker-Interruption

Azure Functions ⚡

I’m using the Azure Functions 2.0 for this and it’s a sample service where I am not calling any real APIs (as I was not able to secure any trial for these airline services).

The purpose is not to show you how to develop an API but to consume it within our Bot Framework Composer.

So, you can see that I just created a sample response which is going to be sent upon receiving a request from the Bot.

Now let’s go back to our Bot Framework Composer where we’re going see how easy it is to call a function (or any API over HTTP(s)). As we have already created a function therefore we will put that URL along with the Flight Number (conversation.FlightDetails.flightNumber) in a query string for a function to get me the appropriate response. Once the response is received, it can be stored in dialog.response property of our dialog.

After this, following a good practice, we check whether the response has been returned as success (statusCode = 200, HTTP OK) or not. If yes then we set the property conversation.FlightDetails which then can be sent as a parameter to AdaptiveCards template (remember our previous post?).

I know you must be wondering what’s conversation? For this, you must read this, the team has done a fantastic job in explaining the memory and their scopes

Azure Functions Bot Framework Composer

Publish to the World 🌏

The support for more than 15 channels is one of the key reasons to love Bot Framework. Not because of the count of channels but because of the point and click experience for almost 13 of them. The rest are from community and they have a really helpful docs for you to get started.

These docs will help you get started with the initial setup on Azure with necessary Resources and Bot Service.

Deploy Bot Framework Bot to Azure

Once you’ve deployed your bot to Azure Bot Service. You can configure any channels where you want to publish your bot. In our case, we will deploy our bot to Teams (reason: it’s fairly new and simple).

Teams integration has now come to a point and click experience (trust me, it was not simple before) and this tutorial will make your life even more easier. With the help of same tutorial, I’ve created a simple app, registered the manifest and viola! It works like a charm. All without writing a single line of code (because you don’t really have to!)

Bot Framework Teams Integration

I am sure you’ve must have got the enough experience to create a production ready bot for your customers (or for yourself 😉). In case you’re stuck somewhere and want some more help in detail, please reach out to me on twitter as I am quite active there.

AMA Airlines on Teams

Until next time.

6 thoughts on “Build a Flight Tracker ✈ with Bot Framework Composer 🤖 – Part 2

  1. Chris V. says:

    Hi there,

    Just finished watching your youtube video on this demo – very informative and provides very useful information using Bot Composer.

    thanks for taking the time to put this material together.

    Chris.

      • Chris says:

        Hi Arafat,

        I’ve been spending some time developing a bot in Composer using a simple AdaptiveCard that has a Action.Submit which only returns a string value “hi there”. When clicking the button in Bot Emulator it returns “hi there” which triggers another dialog – works fine. However when I run the bot in Teams it generates a “Object reference not set to an instance of an object.” message and doesn’t respond with “hi there”. I’m struggling on how to return a string value from an AdaptiveCard when running the bot in Teams using Bot Composer – any idea or documentation you can refer me to that would explain how to do this?

        Thanks

        • Arafat says:

          Hi Chris

          Great to know that you’ve progressed well. I have not tried this scenario specifically with Composer but I will definitely give it a go soon. May I know how are you parsing the value coming in through Action.Submit?

          Please feel free to message me on Twitter if you need a quicker response.

          Cheers
          Arafat

  2. SJ says:

    Hi Arafat,

    I am currently working as a chatbot consultant and I recently came across your blogs and tutorial videos regarding MS Bot Framework Composer. Before suggesting this to the customer as future chatbot platform, I thought of exploring this IDE myself to fully understand its capabilities. We are currently using MS Bot Framework to develop chatbots. While working on one of my initial chatbots using Composer I noticed that am not able to Trigger Intents from buttons. I personally believe that the ability to trigger intents (apart from free text) from buttons is essential for giving a guided UX to end users .
    I created a simple prompt with two buttons: Help and Cancel. I want that Help and Cancel Intents (Triggers which I have created within the same Dialog) should be triggered whenever a user clicks on these buttons. Currently, this is not happening for me and need your help to resolve it? You may refer https://stackoverflow.com/questions/64047940/microsoft-bot-framework-composer-not-able-to-trigger-intent-from-buttons for more details.
    The only other solution I can think of is to call same dialog(s) from button and via Trigger (LUIS Intent) to execute this feature. This is not difficult but it would be more convenient if buttons and free text can execute the same trigger. This feature is currently available in a 3rd party chatbot platform we are using at our site in addition to MS Bot Framework.

    • Arafat says:

      Hi Sahil

      Thank you for your comment. I can think of a solution that’d be easier for you and for your customers.

    • If you’re using the latest version i.e. 1.1.1 then the default Recognizer is selected as LUIS, change it to Regular Expression
    • Once you’ve done that, create two intents, Help and Cancel
    • Upon Help, re-direct the customer to the Help Dialog
    • Upon Cancel, re-direct the customer to the Cancel Dialog
    • Please let me know if that does not work for you and I can briefly explain you on Twitter or on email.

      Cheers

Comments are closed.