BotFramework Exception Wrapping and Custom Error Message

During your time building and debugging your botframework chatbot, you’ve probably already come across the annoyance of seeing a huge error message with a ridiculous stack trace that doesn’t seem to relate to your error, or even just a plain old HTTP 500 and big red exclamation mark..

emulator red exclamation mark

Perhaps you’ve deployed to a production environment and are stuck with the stock error message:

Sorry, my bot code is having an issue

In this article I’ll show you how to 1) display useful exception information, and 2) override the default error message sent to the user

Continue reading

Inaugural LDNBotFramework Meetup Retrospective

We recently wrapped up the first #LDNBotFramework meetup! There were a lot of lessons learned for me, as a first time meetup organiser, and overall I think it was a success.

The venue was great; the big video wall in JustEat’s Fleet Place House office combined with a mic and speaker system that “just works”, a stocked beer fridge and far too much pizza, all made for a perfect tech meetup setup.

LDNBotFramework Team #1!

Erdeniz Hassan, Simon Michael, Robin Osborne, and David Low

Thanks to @beanbaglabs for this group pic!

Sessions

We were very lucky to have representation from Microsoft to kick things off, then some great insights from SkyScanner’s case study, finishing off with a lightning talk on user expectations from JustEat.

Continue reading

Implementing LUIS Routing within BotFramework

In the previous LUIS article, I introduced how to set up and train (and publish) a LUIS language interpreting web service, getting an “intent” and extracting “entities” from a given “utterance”

In this article I’ll use LUIS to enhance your botframework chatbot

If you haven’t done so already, create your bot using botframework, and set up a LUIS application.

Now that we’ve laid the foundations, let’s build a house. A ..um. chatbot house.. yeah.

Continue reading

The Chatbot Revolution and The London BotFramework Meetup Group

If you’re one of the few people who have managed to avoid the onslaught of Chat Bot related articles over the past year, then let me start by way of an introduction; a chatbot is, in it’s most basic form, a computer program that can mimic basic human conversations.

This isn’t particularly new or exciting; this sort of chat bot has been around since the 70s. What is new and exciting is the recent development in systems and frameworks which make creating your own chat bot easy enough that you can focus on the quality of the interaction with the end user instead of wallowing in the technical considerations.

There is a website with a form to fill in that will give you a chat bot at the end of it, all the way through to an enterprise company’s framework for building your bespoke conversational interface from scratch.

Continue reading

LUIS Natural Language Service for BotFramework

Creating a hosted bot using Microsoft’s botframework couldn’t be easier; hopefully you’ve had a chance to create one already, and if not there’s a great introduction to creating your first bot right here.

In the previous article we saw how to create a QnA (aka FAQ/Knowledge Base) service using a little known QnA Maker service of the botframework.

In this post we’ll start to create a more intelligent bot; one which can appear to understand the intent of the incoming message and extract specific key variables from it.

Understanding the intent of a piece of text is a really tricky problem to solve; totally out of scope for this article, and for most bot projects! Luckily, the botframework has a friend called LUIS – the Language Understanding Intelligence Service.

Continue reading

Botframework Data URI images

A quick botframework tip – you can include images in your message attachments by Data URI, not just by URL!

For example, constructing a message like this:

var reply = message.CreateReply("Here's a **datauri image attachment**");
reply.Attachments = new List<Attachment> {
    new Attachment()
    {
        ContentUrl = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAAQABADAREAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAACAUH/8QAJhAAAQMDAwQCAwAAAAAAAAAAAQIDBQQGEQcIEgATISIUMRUjUf/EABYBAQEBAAAAAAAAAAAAAAAAAAMBBP/EAB8RAAICAQQDAAAAAAAAAAAAAAECAAMRBBITIiFB8P/aAAwDAQACEQMRAD8AubjdVbtj5cQFi3tX2lS/ka16Rko9pZqHHfklplgKAylJPNR/vEZPWyvTpUN7jMyK3M21fE03ZLuQ1Gmbyc0j1Dudq7o8RztXFzXEGtacZeQhxipKT7D9qcKUOQ+skfRWKrdqxj71HI4erHME97633Fc+pF10c64pIg7ll6CldoEcHEoTVL7fMZ9se2CPOekdkCiSjIYmLvYvMRdLQPXDG3FGSEzK1iKB4rYCnaan7oVwcCQCHVqGTkkeEefGOgbTtjccyW6sM4QAT//Z",
        ContentType = "image/jpg",
        Name = "datauri"
    }
};

Gives a response that looks like this:

Continue reading

Enable AMP Analytics using a custom WordPress plugin

I’ve recently enabled support for Facebook Instant Articles, Google AMP, and Apple News on this blog following this enlightening article.

It wasn’t exactly plain sailing; AMP needs a logo, and a featured image set for every article (both of which must be above a minimum size); the Instant Articles plugin has a feed url which my feedburner plugin breaks; Apple News needs some real tweaking, but still strips out code blocks from posts.

However, I also wanted to get my AMP plugin hooked up with my Google Analytics tracking. Luckily, the plugin from Automattic has support for this, but I needed to implement the analytics configuration using a custom theme or a custom plugin.

I’m not a PHP developer, let alone a WordPress developer, so this doesn’t come naturally to me! Please bear with me..

Continue reading

Create your first QnA bot using botframework’s QnA Maker

When talking about the botframework, and chatbots in general, people usually assume that these are all using some clever logic and Natural Language Processing (NLP) to deliver a chunk of business logic via a natural language interface.

With the botframework this is most likely implemented by wiring up the Language Understanding Intelligent Service (LUIS): originally a stand-alone, (optionally) self-training, natural language understanding service, but now part of Microsoft Research’s Cognitive Services – previously “Project Oxford” – a collection of extremely powerful machine learning APIs for processing images, video, text, speech, to extract meaning.

Exceptionally powerful, incredibly clever stuff.

Almost all botframework articles and tutorials you’ll see at the moment will either do very basic pattern matching to extract intent from a message, or they’ll use LUIS (or a combination of the two); how to use LUIS is the subject of another article entirely, since this is no small task (I’ll come back to this in another article).

Continue reading

Debugging BotFramework locally using ngrok

No doubt you’re already having lovely long conversations with your bot via Skype (or Facebook Messenger, or even SMS!) built using the botframework, and by using the Bot Emulator you can run your bot locally and debug it.

However, once it’s deployed and is being called via the Bot Connector framework, instead of directly, things get a bit tougher.

If you haven’t managed to override the – rather nasty – default exception handling that swallows exceptions and spews out reams of useless stack trace, then you may not have much idea what’s going on with your deployed bot, since all you get back is “Sorry, my bot code is having a problem.”

When you encounter a strange problem whilst conversing with your bot in Skype, going through the process of adding loads of logging and redeploying, trying again, checking logs – just to see the journey your bot code is going through – isn’t the most efficient.

If only you could debug the code on your development PC just as easily as you could before the bot was deployed, locally in Visual Studio…

In this article I’m going to show you how to debug your bot code from Skype though to your local PC’s Visual Studio instance, thanks to the amazing ngrok!

Continue reading

Summing CSV data with Powershell

As I’ve mentioned previously, I tend to use Powershell for all manner of random things. This time around I wanted to use it to avoid having to upload a csv to google drive or opening up my other laptop that has Excel on it, just to get some numbers.

I’m self-employed, so I have to regularly do my personal tax return. My – extremely inefficient – process involves leaving it until the last minute, then trawling through my online bank account and downloading each month’s statement in csv format and digging through these to find the numbers I need to fill out the various documents.

Naturally, I’d prefer to do this automatically, ideally scripted. So I did!

Continue reading