Using the Bot Framework to create Bots is a great solution for creating code that works across multiple channels with minimal extra effort. Microsoft has continued to build on its platform by looking at the earlier complexities while retaining the ability to work across the channels.
Bot Framework 4.0 was made generally available in September 2018 and it has been a major difference to 3.0. Microsoft MVP for Artificial Intelligence, Stephan Bisser has a great infographic showing a breakdown of the components that make up the Bot Framework (see below). The patterns and concepts layer is where the big changes are, improving the ability to modularise the dialogs (i.e. groups of conversations) and middleware, such as connections to Language Understanding service (LUIS) and other Azure Services.
If you have used earlier versions, you will find 4.0 a big leap and a very different way of working. The focus on Dialogs has shifted and the use of DialogContainers has made it simpler to group expected conversations together. The use of State has been simplified and more samples for saving state using Azure Storage and Cosmos DB made more prominent.
One thing I found very interesting was the ability to create a Dispatch to wrap around multiple instances of LUIS and the QnAMaker that will route to the appropriate service based on the responses received. This reduces the amount of custom code and helps simplify how it appears there, something I have found a struggle in the past. The downside is that setting up the Dispatch is too complex with slightly random command lines needed to be run to merge Luis intents with the QnAMaker. The idea is solid but there is more that can be done with the implementation.
If you are looking to get started with a brand new bot, Microsoft’s Bot Framework Blog has a great post: Build a Microsoft Bot Framework bot with the Bot Builder SDK v4 and there are some very useful samples around Bot-Builder on GitHub: Microsoft Github.
Sadly, I have not found much in the way of guidance on migrating Bots to 4.0 and my experience so far has been to review what your Bot is doing and re-write it, rather than update in place. The ways of constructing your Bot can gain so many benefits in the new format that it is worth the pain.
Finally, a shout out to the Bot Builder Community for all the work they are doing and making information available to fill in some of the gaps in the Bot Framework.
By Kevin McDonnell, Senior Technical Architect at Ballard Chalmers
About the author
Kevin McDonnell is a respected Senior Technical Architect at Ballard Chalmers. With a Master of Engineering (MEng), Engineering Science degree from the University of Oxford he specialises in .NET & Azure development and has a broad understanding of the wider Microsoft stack. He listens to what clients are looking to achieve and helps identify the best platform and solution to deliver on that. Kevin regularly blogs on Digital Workplace topics and is a regular contributor to the monthly #CollabTalk discussions on Twitter.