How to Work with Microsoft Bot Framework Since Last Update
If you work with Microsoft bot framework you probably have seen the banner inviting to migrate your bot. You can check the web for creating bots is not exactly the same, there are some things that are gone. The settings and testing area of the bots you had created before the update are still enabled and visible from dev.botframework.com. Nevertheless, if you create a new bot the settings area have changed.
Perhaps in the old bots settings, if they are not migrated yet, the web view looks odd, will tell you here why.
1. Start
The way of creating bots has changed a bit. Now Microsoft will redirect to Azure and it will force a subscription to Azure for creating a Bot Service. Azure will give you credit for 170 € for subscribing, at least in my case.
Once inside Azure, you will see 3 kinds of ways to create a bot:
- Web app bot
- Bot channel registration
- Functions bot
In this post, we are going to see some theory and practice of how to work with the new version of the bot.
2. The Theory
a. Web app bot
This is the classic implementation of a web chatbot. There is a form with templates in Node.js or C# with some use cases to choose between.
We have chosen to generate a bot with a cognitive service called LUIS (Language Understanding System) from Microsoft. This will allow us to create a bot with intent recognition.
Once the bot is created it will need to have one name for the bot and another for the web app.
b. Hosting
Choosing the web app implementation the only way of hosting your bot is Azure. When selecting the template it will automatically create a place in Azure where to host your code.
If you still want to add your endpoint and host the bot code on your own you will need to go over Bot Channels Registration with a valid SSL certificate in your domain will work.
c. Code
The code that will be hosted in Azure it is available in three ways on the platform:
- Editing the code online
- Downloading and uploading a zip file
- Setting up the continuous implementation. It works firstly downloading a zip file and creating a folder in a third party repository supported by Azure. Then it will require some configuration and every time there is a change in the specified branch it will deploy a new version of the bot.
For the continuous implementation, there is a set of providers that will help to deploy every time it is required.
d. Channel Registration
For setting a new channel is required to be in Azure too. The available channels didn’t change, in fact, look like the option in the menu for this is the same as the web was for the bots before but changing the CSS on top.
This slight change makes the platform look good on Azure but odd in the previous bot. It looks the web is the same and CSS is not optimise any more for old version bots.
e. Testing
There are no big changes on this part. Now is fully integrated into Azure.
f. LUIS
Because we have chosen a bot with intent recognition Azure created in www.luis.ai a new instance linking with the bot and will serve our needs.
There is no clear explanation why LUIS app is created in www.luis.ai which is US domain. I think it should be created in eu.luis.ai because we have selected West Europe region in the selection. Perhaps the Azure team is still working on that, this is a beta version.
3. The Practice
For working example, we have selected Functions Bot Service then we don’t need to worry about the settings for the Web app or any server. The Azure function will do the job, it will execute our code under the specs.
This implementation is very smooth and transparent when creating the bot in Azure the Functions already work as expected.
In this code we just use the simplest bot code we found in the doc.
After adding some modifications and enabling automatic deployments it is even possible to see the details of the deployment.
4. Changes and improvements
a. Testing
For testing the server, it was required to have an HTTPS domain, which can get buying a certificate for some own domain or for fast prototyping using tunnelling tools like Ngrok. Now all this setup is not required anymore. A domain is assigned to the bot and that can test since the very beginning.
b. Automated deployments
On my opinion, this is the most relevant feature. From now on, the bots can be deployed by third providers updating the code in that provider and configuring in Azure.
c. Generic templates
In the new version, Microsoft added some generic templates for the most popular use cases. For now, the only languages available are Node.js and C#.
d. Online code editor
Microsoft has also included an online editor for quick fixing or small urgent production changes.
e. Hosting
It looks that Microsoft now owns all the bots created with its framework because servers are not hosting configurable anymore. i won’t consider this as an improvement but in some small projects looks like the fastest option.
5. Conclusions
It seems like Microsoft switch in the artificial intelligence area has a clear purpose of rounding product, tuning some features and having a bit more control. I hope new features overcome the current ones.
Photo by Max DeRoin from Pexels https://www.pexels.com/photo/keyboard-green-51415/
Hope you liked it, if so please share it.
Thanks for reading.