Introducing, PackBot !

PackBot!


I watched the excitement of //build 2016 remotely, and was genuinely amazed at both the new openness of Microsoft, and the incredible technologies announced. One of the things that caught my attention was the bot framework. This is a new MS technology that handles the crazy plumbing needed to build a complex and effective chat-bot, I have experimented with writing a bot before, but always came away thinking – nope, I’ll wait until I come across a good framework, there’s got to be an easier way!

Well, guess what – the easier way has arrived, and it’s the Microsoft botFramework !

So what’s a chat-bot?

If you dont know what a chat-bot is, here’s an example…

Lets say you have a problem with your cell phone account and you need assistance. As cell phone operators have massive customer bases, getting through to someone on the phone can be difficult, if not impossible. It’s typical for one of these telcos to have a big unwieldy FAQ page that you are expected to wade through to find an answer. Not ideal, and can be very frustrating at times. What if instead of having to do all that visual searching, you could just hook up via text/online-chat/skype/whatever, and ask a natural language question such as…

‘hey, I’m a customer and am having issues with billing, where can I go for help?’.

The system would intelligently parse what you said by breaking the language down into questions such as … does ‘having issues’ mean ‘problems’?, does ‘where can I go’ mean ‘what department do I contact’, is it the same thing as ‘who can I reach out to’?

Having parsed the question, it could determine the answer, and chat back to you with:

‘Hi there, thanks for getting touch – you need to get in contact with the billing department for your area’

Ok – so thats cool enough – now what if it could go a bit further? … what if it could have a viable chat with you the customer, back and forth, and either attempt to solve your problem, or make things a bit easier for you… now things start to get more interesting…

‘Hi there, thanks for getting touch – we need to get billing involved – would you like me to connect you? … I can do it now, or schedule a call for later if you would prefer?’

Let’s say you are busy at the moment, going into a meeting or something, so you respond with ‘great, thanks for the help – can you schedule a call back for after 6pm?’

The system does its parsing magic, schedules a member of the billing support team to call you at say 6:15pm, and goes one small step further..

‘Ok, I’ve logged one of my billing colleagues to get in contact with you at 6:15 this evening – I’ve also sent a calendar entry to your diary, and will send you a quick text a few minutes before the call to be sure you can still take it’

Wow – wouldn’t that be AWESOME ? … well, using the microsoft bot-framework, there’s no reason it couldn’t be built, and it’s pretty simple!

Enter the MS Bot Framework

So, my easier way has arrived, and it’s looking pretty good. The bot framework consists of two parts, the ‘bot builder’ and the ‘bot connector’. The builder helps you put together bots that can work with either free form interactions like the example given above, or more guided ‘conversations’, where the user is given more specific choices and is expected to answer in a particular manner. The framework can be hooked up with incredibly powerful and useful AI frameworks such as LUIS, and can run at cloud-scale. The bot connectors allow you to hook up your bots to other existing (or new) bot communication channels, such as Skype, Slack, SMS, Email etc. Combined they make up the framework and are an incredibly powerful new tool in the developers skilled hands. I predict that when the business chaps get a firm understanding of what bots can be used for, they will become the next ‘we need a mobile app’ mantra from the corporate hallways!

I really think that for developers, the bot framework is as much of a game changer as the ‘app store’ was in its early days. Its powerful, yet simple, and its potential reach is incredible – I can see massive opportunities ahead…

Gotcha!

I have been itching to build my first bot since I heard about them – unfortunately I kept hitting problems getting the thing to install for me in Visual Studio, despite *very carefully* following the instructions (you know how it goes….). Anyway, after going onto my new found friend Twitter, I was able to reach out to the community legend that is Scott Hanselman @shanselman and tag the bot framework guys #botframework, and soon after got a suggestion for a fix/issue from Dan Driscoll @thedandriscoll.

So, after the rambling intro, heres the meat… when setting up bot framework, you download a zip template file, and place it, unzipped, into a C# template folder. When you start Visual Studio, and run a new project, it should read this template folder and in this case, the ‘Bot Framework’ should appear as an option in the template menu. In my case, this was failing, yet I could clearly see the zip file where it should be.

OR WAS IT !!!??

Dan passed the little nugget on that another user had a similar problem and it turned out they had a duplicate documents/template folder in OneDrive …

OneDriveFolder

Well, as it happened I hadn’t got OneDrive live on the virtual machine I was running on, but I did notice that there was a duplicate documents folder hanging around on my mac … and boom-diddly, once I dropped the zip file into that folder, we were off to the races…

Bot App

Next step – let’s built a bot – the plan!

To get to this stage, I think I spent the bones of 4 hours messing around, installing/uninstalling, searching the interwebs for solutions to get to this stage. I did ask Dan to put the suggestion of watching for duplicate folders into the setup guide to save others my hassle and I think thats done now. So anyway, having got up and running I’m MEGA EXCITED to start planning what will be my first bot … and it’s gonna be called, grab this ‘PACKBOT‘ 😀

The concept came about when I was boring the ears off everyone at the dinner table last night, explaining what a bot was. Somehow (as happens), a bit of an idea from here and a fragment of a story from there, and suddenly a project was formed … how about a bot that could advise you what to wear for the day? .. how interesting … let’s examine how it might work..

At its simplest, the user would ask the bot a question, that would be constructed using tokens of ‘location’, ‘time period’, and ‘time span’ – here are some examples:

“What should I wear for work”

This has a location (work), but no time period or span, so the bot will assume it means ‘for now’, and will go off and check the weather for the (default) work location using some weather API, and give a suggestion based on what metrics it finds… (London is wet and windy but warmish right now).

“May I suggest you wear something light, but cover up with a long rain jacket – its wet and windy out there!”

“I’m going to Liverpool for the weekend, what should I wear?”

we have location (Liverpool), a target period (weekend), and an implied time span (Friday to Sunday) – so the bot will check the weather, for Liverpool, from Friday afternoon to Sunday evening, and make a suggestion… (Liverpool shows good weather all weekend but windy on Sunday).

“My suggestion is something light, there is no rain predicted and it’s warm. Think about bringing a fleece for Sundays wind, but if you wear a hat that day, you may have to chase it down the road”

So you get the idea. Depending on the location, perhaps certain user preferences, time of year, and of course the weather api forecast in the given timespan, the bot makes a general suggestion for suitable clothing to wear, or pack!

Right, so that’s the plan – the next step is to get stuck into the framework and pull my Packbot together – watch this space and I’ll let you know how I get on ... or, if you are attending the Hyderabad or Chandigarh C# Corner conferences, I will be going through this cool technology there :)


Similar Articles