What do you get when you combine Azure Static Web Sites, LUIS, SharePoint Online, Logic Apps, and Microsoft Teams?
Sometimes you just have to punt on the title of your blog post and let SEO do the heavy lifting.
A few months ago, I presented a session at Microsoft Ignite on creating a QnA bot using the QnA Maker. I also blogged about it and created a video walking you through the mostly painless process:
Now, this solution works great, and ANYONE can do it. However, as some have pointed out, it’s not free… and could end up costing you a few thousand dollars a year for the service based on usage.
But it’s SO easy to build!
Since then, I’ve been looking at other technologies and options for creating the same functionality but without having to spend the money… and with a little help from Rob Windsor the Microsoft Teams Hillbilly Bot was born… really… I can’t think for a better name for it. I tried several, the best I could come up with was “The almost-free, low-code QnA Bot That You Can Use in Teams” but that just doesn’t have a ring to it…
Also, I haven’t posted anything hillbilly related in a while… so, you’re welcome.
One of the things I like about this solution from a strictly educational standpoint is the number of technologies it uses. This is a great way to broaden your skillset in a very non-overwhelming manner. The technologies we will take advantage of in this blog post are:
- Azure Static Web Sites
- LUIS – Language Understanding
- SharePoint Online
- Logic Apps (you could also use Flow)
- Microsoft Teams
I know, that sounds like a lot of moving pieces (and it is) but they all work in such a strangely easy harmony you’ll wonder why you didn’t get started on these technologies sooner.
So, let’s just jump right in, I don’t want this to become one of those recipe sites that talk for pages and pages about the history of the kidney bean and why it reminds you of that time in Tuscany instead of just giving you the ingredients and telling you how to make it… seriously… stop it recipe people… you know who you are…
Step 1. Azure Static Web Sites
Step 2. LUIS – Language Understanding
LUIS is “a machine learning-based service to build natural language into apps, bots, and IoT devices. Quickly create enterprise-ready, custom models that continuously improve.” Basically, LUIS is the heart of your bot. Using LUIS you can configure questions users might answer to determine their intent. So, if a user asks “How do I request time off?” LUIS might be able to determine the intent was “VacationRequest”. The more utterances you configure LUIS with, the better probably of LUIS identifying the user’s intent. Part of the response from LUIS is a “score” that tells you the probability that LUIS guessed the user’s intent. You can use this score to help refine LUIS and continually improve the experience for users. You can also set up Phrases and Patterns in LUIS to further improve responses. We are really just scratching the surface with LUIS here in this post.
As far as pricing goes, LUIS is free for 5 transactions per second (text only).
Step 3. SharePoint Online
We’ll use a list in SharePoint online to store the responses from our Chat bot using the intent keyword returned by LUIS. This will allow people without Azure accounts to maintain the responses of the bot and allow for easily creating rich text formatted responses.
Step 4. Logic Apps
Now we need to update our script to query the SharePoint list for the correct response based upon the intent keyword. We are going to use a Logic App for this. Using a Logic App we can create an HTTP Request trigger and connect to our SharePoint List and return the results to our script without having to authenticate to SharePoint.
You could do the same thing with Flow, but with the recently announced licensing change, the HTTP request trigger will soon be a premium feature. If you still want to use Flow, you can adapt the blog post I did on that:
There are other ways to query the SharePoint list as well especially if you are in the context of SharePoint, but again, this is a great way to get acquainted with Logic Apps if you are brand new to them.
One final note about Logic Apps, there is a usage fee associated with them. This fee is based on number of actions and which connectors you use. Based on the pricing found here I’ve estimated this Logic App will cost about 17.5 cents for every 10,000 executions.
Step 5. Microsoft Teams
At this point, the QnA bot is functional and you could use it on any website you want. Who knows, maybe I’ll even deploy it to my WordPress site someday… eh.. probably not.. those darn pesky Russian hackers would undoubtedly run up my Azure bill just for the fun of it… But let’s take things a step further and deploy our bot as an application in Teams. Now we’ll have access to the Teams context and it will give us a good starting point for adding even more functionality to our Chat bot in the future… we can even use the Teams context to determine if we are in Teams or not and take appropriate actions.
So, halfway writing this blog post it hit… Why don’t I remove some of the complexities of this solution and any “perceived” security concerns with the anonymous URL’s and develop the whole thing with LUIS, PowerApps, SharePoint, and Flow? I mean… might as well try to touch EVERY piece of Office 365… right? Well… let’s do that then… but how about me move it to another blog post:
Static website hosting for Azure Storage now in public preview
LUIS – Language Understanding
LUIS Endpoint API
Cognitive Services pricing—Language Understanding (LUIS)
Quickstart: Create your first automated workflow with Azure Logic Apps – Azure portal
Logic Apps pricing
Source Code Used for Hillbilly Chat