This blog has been produced by Jamie Dalton UK Technical Evangelist
AI and Bots are hot right now, everyone wants one as they realise the business value of reaching their customers via the various conversational channels (Skype, Facebook Messenger, Kik, Office 365 mail etc..) that they are already using they to serve their needs.
This article isn’t going to go into depth about the different types of bots that you can develop and whether you should be building a truly intelligent bot (the answer is yes btw) this post is geared around building out simple low friction “chit-chat” bots – such bots take a turn-by-turn approach with the user
Yo Pizza Bot
A typical example is the pizza ordering systems the process is as follows
- Bot: “Hey I’m a Pizza bot”
- User: “Wow, another one? Well, that’s handy as I’m pretty hungry right now”
- Bot: “Thought so, what toppings do you want?”
- User: “Ham and pineapple”
- Bot: “Good choice, now what crust do you want?”
These conversations follow a linear path and thus easy to develop. However, even though these paths are relatively simple, what happens if the user changes their mind to a previously answered question, wants to go back to the beginning or terminate the conversation half-way through.
Bots and Logic?
The logic begins to get more complicated. If you then have branches within your questions you’d then need to handle those various different dialogs.
Microsoft Bot Framework
So what is FormFlow
FormFlow essentially allows you to define a class with properties and the framework automatically generates the conversation and handles the state management of it as the user answers each question. If the user changes their mind to any previous answers, the framework allows the user to navigate back in the conversation and change their response. The keywords it can understand during any conversation are:
- Back: Go back to the previous question.
- Help: Show the kinds of responses you can enter.
- Quit: Quit the form without completing it.
- Reset: Start over filling in the form. (With defaults from your previous entries.)
- Status: Show your progress in filling in the form so far.
- Selection: You can switch to another field by entering its name. (Question 1-10).
One great thing about FormFlow is that it supports JSON schemas, this makes it exceptionally easy to build out simple chit-chat bots that could be used for any scenarios such as Questionnaires/Customer Surveys/Polls/Frequently asked questions (FAQ).
You also add some insights and feedback into the app for example you can add telemetry to record the total number of responses to a specific question. To save the telemetry is simple with Application Insights, snippet below:
// Wang in your own telemetry here, responses is key/value pairs TelemetryClient telemetry = new TelemetryClient(); telemetry.TrackEvent("BotSample", responses);
customEvents | extend p1 = customDimensions.p1 | order by timestamp
Key success and telemetry
Being Agile and success you don’t want to spend large amounts of development effort second guessing your customer usage. Here, you are best to iterate something fast then using telemetry track insights such as:
- Is anyone using your bot? If the answer is no, then maybe your customers aren’t aware you have one, what it does or simply that it doesn’t serve their needs and you need to rethink the scenarios it offers.
- What time of day is it being hit? Is it when your traditional support lines are closed? Since you now effectively can offer a 24×7 support channel if you are using it for customer service scenarios
- What channels are they reaching your bot on? Some conversational channels (eg. Skype/Facebook Messenger) maybe more popular than others.
- Did your bot answer/solve the customer query? If not, you could add that scenario to your bot for other users.
I’ve now created a new “BotSample” which uses FormFlow and a JSON template similar to the Brexit Bot), which will allow you to quickly spin-up and deploy a bot using Application Insights for telemetry, rather than me discuss anymore on what this bot does, it’s best you try it out for yourselves to get a feel for it. This sample uses the latest v3.0 of the framework released on 7/7/2016.
Give the bot a try
Simply open the following URL http://bit.ly/29sjzKj which links to the BOT hosted on Azure.
The complete code is available on github, speak to the bot and it will serve you a direct link to the repo