Some of you might have seen some ridiculous social media posts from me showcasing a question and answer bot while at D365/AXUG Summit this week. Certainly, the AXUG team did a great job planning the event (producing the best conference companion app I’ve ever used). That said I still wanted to celebrate the big event with something unique. A new PowerBI social media dashboard didn’t seem quite enough for such a momentous event and I’m certain most people didn’t really pick up what happened with the facial recognition Twitter account Jake and I made last year. Looking for something new, I started poking around the Azure AI + Cognitive Services and Data + Analytics marketplace offerings. Bots and AI seem like a hot topic and with Microsoft increasing their focus on “systems of intelligence” with an updated vision statement (https://www.cnbc.com/2017/08/02/microsoft-2017-annual-report-lists-ai-as-top-priority.html) from Satya, I thought to start there. It was surprisingly easy to set up and launch and to prove it I’ll try to provide a guided walkthrough for those of you who might want to try something similar. Just a note that even as I write this up, some of the paths have changed slightly so if you try this in a few months some of your screens might look different. First I started by creating the Azure Bot Service by clicking New -> Data + Analytics -> Bot Service. Name your bot, and fill out the drop downs. I already had resource group started for other Azure services, but certainly you can create a new one if you prefer. After the service deploys you’ll get a notification and can go to the resource. You’ll have to select which language you want the bot built from, and then you get to select one of several great templates provided by the Azure teams. It seems to me that once you get more advanced with this service you can combined two or more of these bots but to start I selected the Question and Answer template. Click the “Create Microsoft App ID and Password button”, sign in with your Live ID to generate your App ID and Password. Copy your password and click the link to “Return back to Bot Framework.” Paste your password and accept the terms at the bottom of the screen (cause you read them all right?) Click “Create Bot” and voila! you’re now a proud parent to a newly created bot. Scary? Not really actually. Not yet… Second step is to get this baby to school and teach it a thing or two. To do that you need to make one more connection to a knowledge base. The best (read quickest) way I found was to connect the bot to Microsoft’s QnA Maker service. If you’ve selected the Question and Answer template, you’ll automatically get prompted to connect to this service. Create a new knowledge base by selecting “OK” and after a minute or two you’re ready to start working directly with your bot. Of course, Microsoft gives you access to the underlying codebase for this service, but if you want to keep it simple everything is click-to-code from now on. The templates provided takes care of all the heavy lifting but certainly if you want you can manage your code in Visual Studio and really build out this bot framework extensively. Navigate over to QnA Maker by visiting https://qnamaker.ai/Home/MyServices There you will find the service you just created. Click the edit icon and dive right in! Third step in this process it to train the bot with a FAQ page already available on the web. This is actually very easy, and amazingly worked well. In your Knowledge Base navigate to “Settings -> URLs” and enter the path for a FAQ or other page that has a good simple structure of data that people might want to query. Click “Save and retain” and you’ll soon have a populated knowledge base. You can view the QnA pairs found and retained into your Knowledge Base easily, and edit the ones that might have come over incomplete or where you might want to shorten the response for an easier chat experience. There’s so much more you can do QnA maker, which helps you improve the quality of your bot’s Knowledge Base but from here you’ve done enough to finish QnA Maker if you like. You might choose to train your bot a bit and give some alternate wording choices or something but there isn’t much in “chat” features beyond one question generates one answer unrelated to other questions asked. (NOTE: I did also try to connect to Microsoft’s language recognition service Luis.ai at https://www.luis.ai/ but really didn’t have a lot of luck. After a few hours, I resigned this first bot to some very simple questions and answers and nothing advanced like other conversational bots that are out there. That isn’t to say Azure’s framework can’t handle it. More my patience wore thin trying to think through the architecture, and honestly, I wasn’t even sure anyone would use this dang thing, so I moved on.) Select “Publish” at the top of the screen, review your changes and push “Publish” one more time to confirm your changes and you’re done! You can take a backup of your knowledge base if you get nervous and there are some good import features too for managing larger pairs. Forth step is to get this bot out into the world. Head back to your Azure Bot Service page, and try testing your knowledge base. If you’re getting the results you expected, great work! If not, try going back to the QnA Maker to ensure you published your knowledge base properly. You can also open the advanced settings in the bot service and tackle some manual configuration, but at that point you’re pushing this walkthrough so… best of luck! Assuming all is OK, select “Channels” in your Azure portal. Here you can connect to pre-built API’s provided by Microsoft for extending the access to your bot service. The simplest in my opinion was the web chat channel. Sure a Teams or Facebook messenger app might be cool, but again for my target audience at Summit I though a simple web facing bot would be best. I grabbed the iframe code, and placed it on a new page I created on our website what do you know, Bob’s your uncle, we’ve got a bot!
Extra Credit Section:
I did do a few extra pieces to extend the bot seeing that up to now Microsoft made this pretty simple. I did play with a few other channels and decided to connect Twilio (I’ll give that walk through in another post) to give some additional mobility to the bot. This allowed the bot to interact over text and phone. Only a few people gave this a whirl, but I still thought it was cool and potentially a more “mobile” way for Summit attendees to interact. Also, to make it slightly more interesting, I keyed in the conference schedule so people might use the bot for some useful information. 600 entries later I had an outdated schedule in the bot, but still a decent Knowledge Base for the conference to play with. Lastly, I added a few extra QnA pairs just to keep things interesting. Though, surprisingly, most of the Easter eggs remain undiscovered. I guess they’ll live on to be revealed in v2 of this bot down the road. That’s just me though, what about you? Give it a try and tweet at me how things worked. If you create something, please share your adventures and let the world know what you made.