Chloe Condon
Jul 1 · 9 min read

The following blog post will walk you through how to use Microsoft Azure Bot Services to create a simple chatbot using minimal programming, Twilio, and a Word Doc.

If you’re looking for a quick summary and overview on the Azure Bot Service, I recommend starting here with our documentation, or taking an hour or two to complete a step-by-step Learning Path, so you have some context on the various bot options available with Azure.

This post is part 1 of a series of posts on how to create various bots that can be built using Azure, with varying difficulty (this post being the easiest).

Happy botting! 🤖

-Chloe

I’m a big fan of using technology to solve problems and common sources of anxiety in my life. If you’ve followed any of my content in the past, you may be familiar with my fake boyfriend app that I used to save me from awkward social situations, as well as my ADHD medication reminder. Lately, I’ve been dealing with a lot of stress and anxiety around my DMs. Specifically the amount of inbound I get on Twitter, Instagram, Facebook Messenger, etc. Often times I drop the ball because I read a message on the go, promise to respond later, and well… apologies to anyone I’ve ghosted 😬👻. The truth is, as a Cloud Advocate, my role is incredibly social. My DMs are often full of attempted coffee meeting plans, memes from friends, speaking inquiries, bootcamp grads seeking career advice, and the occasional unwelcome “hey” from a random dude I’ve never met 😑.

Unfortunately, due to the volume of inbound I get, I often get overwhelmed by all the noise. Not only do constant messages and notifications make it difficult to focus (especially while programming), but I also feel terrible when I drop the ball on folks. So, I started playing around with Azure Bot Service to see if there was some way to build a bot that would help me manage and automate my communication with folks.

After some quick brainstorming, I figured out that my DMs typically fall into the following categories:

  • Azure related questions 👩🏼‍💻
  • Bootcamp grads seeking career advice 🙋‍♀️
  • Speaking inquires 🎤
  • Ongoing conversations with close friends 👯‍♀️
  • Creepy folks (bots?) I’ve never met just saying “hey” 🙅🏼‍♀️
  • Miscellaneous opportunities (podcasts, interviews, specific Furby hacking questions, etc). 🎧🎙🎭❓

I knew that I wanted to build a bot, but I didn’t want it to respond to every inbound message. For example, if I had a way to automate responding to commonly asked questions from bootcamp grads, I could save a considerable amount of time. Whereas a message from an Azure user would require a personal/detailed response from me. Additionally, I brainstormed the idea of training my bot to help me schedule and organize speaking opportunities, as well as flag or delegate important inquires/messages. However, I had never built a bot… but thanks to Microsoft Learn- I was able to get up and running with my 1st bot in under under an hour!

And so, I built my first bot using QnA Maker. If you’re unfamiliar, QnA Maker allows you to create a bot using a simple FAQ list. Below I’ll walk through how you can build your own QnA bot to help delegate inbound messages for yourself. If you’re a small business owner, CEO, teenage girl, or anxious-tech-worker-afraid-of-dropping-the-ball-on-DMs like myself, building your own bot is shockingly easy (seriously, it feels like witchcraft ✨😳).

Let’s review what we’re doing real quick…

The Problem: Noisy DMs + Constant Anxiety from Unanswered DMs
The Solution: Build a bot to help respond and automate common messages I receive online
The Technology: QnA bot

Below is a visual of how we’ll build our QnA bot from the docs.

Let’s Create a Knowledge Base & QnA Service!

First, head to the QnA Portal (https://www.qnamaker.ai/) and sign-in in the right corner with your Azure credentials. Click over to to Create a Knowledge Base (https://www.qnamaker.ai/Create).

The knowledge base for our bot will be a collection of searchable questions and answers. It will be hosted in a QnA service in Azure. Click on Create a QnA service (button highlighted in pink below).

Let’s Provide QnA Maker Service Details!

Next, we’ll need to provide some details for the QnA Maker, including a unique name, Azure subscription, location, etc. Pictured below are my inputs. You’ll notice I’ve selected F0 for pricing (free tier) and have chosen West Coast (closest to my current location) for all locations. I’ve also created a new resource group called ChloBots (you can name yours whatever you’d like). For pricing tier, I’ve selected F (three indexes) which is the free tier for the search pricing tier. I have also disabled App Insights for this demo, but enabling is also an option if you’d like to have monitoring data (you can learn more about that here).

Click Create at the bottom of the page, and in a minute or so you’ll have a resource created for the service.

Let’s Connect Our QnA Maker Service to the Knowledge Base!

Head back to the QnA Maker web portal. If you refresh the page, dropdown menus showing your account info will show up under Step 2. Select the Directory ID, subscription name, and QnA service (the ones we just selected/created in the Azure portal).

Scroll down to Step 3 and provide a unique name for your Knowledge Base. I’m naming mine ‘BootcampBotFAQs’.

Populate Knowledge Base

Download this Word doc of FAQs I’ve created (obviously, you can create your own set of FAQs or edit this file to customize it for your own bot). Under step 4, add the file in QnAMaker.

Under Step 4, you can also choose the type of “Chit-chat” your bot will have. This will determine the personality of your bot. Options provided range from ‘professional’ to ‘enthusiastic’, or none at all. I’m going to go with ‘friendly’, since I want to make sure my bot is overwhelmingly welcoming and kind to everyone it encounters. 😁

If everything looks good on this page, go ahead and click Create your KB. After a short wait, we’ll have a Knowledge Base and the Edit page will load.

Let’s Test it Out!

Believe it or not, our bot is already ready to test (told ya it was witchcraft 🔮)! In the top right corner, click Test and you can go ahead and test out your bot! Go ahead and ask it some commonly asked questions, and see its responses.

Let’s Publish Our Knowledge Base!

Once you’ve tested out your bot and you are confident in it’s answers, we can go ahead and publish our knowledge base!

Head to the QnA Maker Knowledge page (the same one we’ve been testing in) and click Publish located at the top of the page. You’ll be taken to a page letting you know that your Knowledge Base will no longer be in test mode, and it will become an endpoint you’ll be able to use. If all goes smoothly to this point, you’ll see a Success! page containing a URL.

Let’s Integrate!

In the Azure portal, click on Create a Resource on the lefthand side of the page. In the search bar enter “bot”, and find Web App Bot. We’ll now create a web site for our bot, and we’ll also get it registered with Azure Bot Service. This looks similar to the QnA Maker Service we created earlier, but with a few minor adjustments. Provide a name (this must be unique!) for your bot (I’m naming mine “chloebootcampbot”), and select your subscription and the resource group you used/created previously. Use S1 pricing tier, and under Bot Template select SDK v3 and C# for language as well as Question and Answer for the template.

Once Create is clicked, it’ll be ready in a few minutes!

When you get the notification that your deployment has been successful, navigate to the left hand navigation of your recently created Configuration section to view your Application Settings.

Let’s Connect Our Bot to Our QnA Service!

Here’s the part where we connect it all together 🤖 If you don’t already have it open, create a new tab to sign into your QnA Maker account and find the details for your QnA Maker service that was published. In the Postman sample, find the GUID (this represents the knowledge base ID) and copy it. We’ll paste that GUID and select the Hidden Value for QnAKnowledgebaseId in our Application Settings.

Do the same for the QnAEndpointHostName and QnAAuthKey in Application Settings. Save these settings, and find Test in Web Chat under the Bot Management section in the left side navigation. Our bot is now connected to our QnA Maker Service! 🎉 Test out the bot by asking it a question or two, and your bot should be up and running and at your service.

Congrats- you did it! You now have published a QnA Maker service that has been published on Azure. Your web chatbot has been integrated with QnA Maker and allows folks to chat in a interactive way with your bot. OK, that was a lot… let’s take a look at that diagram again, shall we?

Let’s Connect it to Twilio!

Now we’ll need to connect it to the proper Channel. I’ve decided to use Twilio for this, since I’m familiar with their API. If you’re unfamiliar, Twilio allows software developers to programmatically make and receive phone calls, send and receive text messages, and perform other communication functions using its web service APIs. Head over to Twilio, and set-up an account if you don’t have one already (🙋‍♀️ FYI you can use code CHLOE20 for some free credits). You can use Twilio in all kinds of ways (fake boyfriend apps and ADHD reminders to name a few 🤳)!

Once you’ve created a Twilio account, create a new project. We’ll need a couple things to get our bot connected to Twilio:

- A Twilio phone number
- A Twilio Account Sid (acts as a username for our Twilio app)
- A Twilio Auth Token (acts as a password)

Give your project a unique name (I named mine “BootcampBot”), and you’ll be taken to your dashboard. In the left-hand side navigation, click on the Phone Numbers section (labeled as ”#” — can’t find it? it may be hiding behind the ”” icon that you need to expand!). Click on Buy a Number and hit the Search button. Once you find a number that suits your needs (the area code doesn’t matter, but it will need texting capabilities!), click Buy (note: phone numbers typically cost about $1-$2 monthly).

Let’s Create a TwiML App!

Now we need to create a TwiML app so we can give it a Request URL (in this case, https://sms.botframework.com/api/sms) for messaging with Twilio. In the Twilio console click through to Programmable Messaging > Tools > TwiML Apps. Click the red ➕ sign icon, or Create new TwiML App.

Fill out the TwiML App form with a friendly name, and under Messaging add https://sms.botframework.com/api/sms as the Messaging Request URL (HTTP POST).

Lastly, navigate back to the Azure portal, select Channels (under Bot Management and add your Twilio credentials to your Azure Web App Bot like so:

NOTE: Make sure you keep your Twilio SID + Auth Token private and secure!

To test that all is working smoothly with your bot, text a question to your Twilio phone number, and enjoy! You’ve successfully built a QnA Bot with Azure, and hooked it up to Twilio- SUCCESS! 🎉

Here’s a video of my bot in action (I’ve added the bot to my contacts as “🤖 Bootcamp Bot 🤖”.

YES! Our bot is alive!

If you’ve made it this far, congrats on making your first basic bot. As you can see, QnA Maker is an incredibly simple way to create a basic bot to manage commonly asked questions for customers, friends, family members, or bootcamp-curious folks. Do you have an FAQ page on your site? Then you can build a bot for it!

As always, here to answer any questions, tackle any bugs, or help you build your own. Comment below, or reach out on Twitter if you get stuck! I’m here to help.

🤖💖 -Chloe

Microsoft Azure

Any language. Any platform. Our team is focused on making the world more amazing for developers and IT operations communities with the best that Microsoft Azure can provide. If you want to contribute in this journey with us, contact us at medium@microsoft.com

Chloe Condon

Written by

Musical theatre actress turned developer evangelist.

Microsoft Azure

Any language. Any platform. Our team is focused on making the world more amazing for developers and IT operations communities with the best that Microsoft Azure can provide. If you want to contribute in this journey with us, contact us at medium@microsoft.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade