Easy booking bot with flexible Adaptive Cards

Ever since the bot uprising, SMEs have started investing in innovative solutions for better productivity in an optimal cost. Customer services, on all fronts, require a human being. However, 90% of the time that human is doing nothing but following some standard procedures to get things done.

As I mentioned in my previous posts, there are many areas where you do not need a task force of humans but just one person supervising the bots. One of those areas is Appointment Booking with a Doctor.

This use case is quite useful and can be modified according to your needs for Spa & Salon, Test Drive etc. 

Apart from the usual code of booking the bot, I will write about the implementation of Adaptive Cards, which is a new lightweight & open framework to exchange content in a common and consistent way. In addition to that, I will also discuss how to cater the problem of matching the closest string if your customer writes a wrong spelling or he/she is not sure about the correct name.

The code which gets committed and merged to GitHub repository is always workable. However, as I or other contributors have been adding it for the sake of Demos so we usually ignore styling, formatting of messages or other best programming practices.

So, let’s discuss about the closest string mechanism: The Distance Algorithm.

Let’s assume you have got 10 doctors in a clinic and each doctor’s name is there in your database for whom you would book the appointment. However, usually customers are not aware of the correct spelling of doctor’s name because of verbal references / recommendations by someone. To address this, I have used a distance algorithm called Levenshtein Distance which would match the closest spelling and bring out the correct name from the doctor’s list for your customer.

Distance Algorithm

Next, we have Adaptive Cards, requesting input from the customer. In addition to the pre-defined 6 or 7 cards in Bot Framework, we now have full capacity to incorporate anything we want into this card. You must try the Interactive Visualizer of Adaptive Cards. This is one of the simplest kinds of card I could design to show you the flexibility of it. I just had to download the package from NuGet and wrote a small piece of code to get it working.

Adaptive Card

Unfortunately, the documentation of Adaptive Cards is not very good and that’s why it does not have much to offer but if you invest more time in understanding it, you will realize that it has a lot of potential to float everywhere!

This demo code is committed and merged at GitHub. Please feel free to contribute.

Related Posts