• The AI Clinic
  • Posts
  • Building Your Own Chatbot Using Microsoft's New AI Hub (Part 2)

Building Your Own Chatbot Using Microsoft's New AI Hub (Part 2)

The AI Clinic: Deep Dive #3 | Subscribe

Editor’s Note: This tutorial is a continuation from last week’s deep dive. You can find the first part here.

Hello again!

Every Tuesday, we take a closer look at the AI tools and trends shaping the future of healthcare. As artificial intelligence fundamentally changes the workplace, staying ahead of the curve isn't optional — it's essential for those who want to excel in their roles.

This week, we're doing the second part of our exploration of Microsoft's Copilot Studio. If you missed the first part, you can find it here. Our goal is to build our own usable chat bot from start to finish that we can deploy to our own website.

“When Last We Left Our Heroes…”

Okay. Where were we?

When we left our chatbot, we had compiled some basic features:

  1. Logged into the Microsoft Copilot Studio

  2. Created a new agent

  3. Configured it using basic instructions for what we wanted

  4. Gave it a website to use for its “knowledge base”

  5. Setup some a dialog flow (“topics” in Microsoft parlance) to get user information for people wanting to schedule an appointment

  6. Setup other basic dialog flows

  7. Tested the chat*

*One of our readers pointed out that the chatbot had to be reloaded before it would recognize the content of the knowledge base. It took about ten minutes and reloading the page for the content to be usable.

Overall, I’ve been fairly impressed with the breadth and depth of Microsoft’s offerings. The user experience is clunky and there’s lots of edges to be smoothed, but as I’ve said with many AI features - the versions of the tools we’re using are likely to be 2-3x better in the coming years.

Our job isn’t to wait for the tools to be perfect, it’s to figure out how we can use imperfect tools. Anyways, let’s jump in.

1. Finalizing Our Topics

Let's finalize our "topics" for the chatbot, which control basic dialog flow. Your final topics should look something like the following.

2. Setting up our Spreadsheet

We want our chatbot to be able to take the user information and put it into a spreadsheet. So first we need to set our spreadsheet up with the appropriate fields.

Go to https://excel.cloud.microsoft/ , login to your microsoft account (if you havent already).

Hit "create blank workbook".

Label your workbook as "Patient Leads" and setup your columns for the patient data.

Highlight the columns you created and hit the "Format As Table" button on the home ribbon.

Save the file somewhere you can find it in your OneDrive or Sharepoint (important).

3. Creating our Automations

Next, we need to add to our "Generate Lead" topic to use the spreadsheet. Reopen the "Generate Lead" topic from the Copilot Studio.

At the bottom, hit the plus sign under our last question.

Select the "Call an action" choice and hit "Create a flow". A new tab will open and launch Microsoft's Power Automate suite.

You should see this screen now.

Click on the top square and a new pane opens on the left.

Add two text inputs and name then "Patient Name" and "Phone Number"

Hit the plus sign under the "When Copilot Studio calls a Flow" rectangle and select "Add an action"

In the new menu that pops up, select "Excel Online (Business)".

Then select "Add a row" in the next screen.

You should now see this.

Now, remember earlier when we said it was important to save the excel file somewhere you could find? Now we'll need to use these dropdowns to pinpoint the location of the excel file.

Here's what my final screen looks like.

Under Advanced parameters at the bottom, hit the show all button and then sync up the various variables with the variables we created a few steps ago by pressing the lightning bolt and selecting from the available variables. For Date Added, just put utcNow()

For bonus points, I'm adding an additional action that is going to email me whenever a patient is added to the spreadsheet. Follow the same steps as before, but select "Notifications" and "Send me an email notification". Then create a Subject and Body of the email.

Our final flow looks like this.

4. Adding to our Topic

Now we're going to go back into our chatbot tab to put it all together.

Refresh your Generate Lead tab, then hit the plus sign again and select "Call an action", you should now see the flow we created (I left mine with the default name - "Power Virtual Agents Flow Template").

When you select that flow, you should now see a new "Action" below your questions in the dialog flow.

We're now going to sync up the answers that the patient gave to the chatbots questions to our spreadsheet columns. Hit the arrows next to each field and select one of the options. You should have something close to this at the end.

I

If it looks right, add two more small actions - a “Send a message command” that sends a confirmation from the chatbot, and then an “End current topic” action to wrap things up.

Hit save to finalize our work.

5. Testing our Final Chatbot

Now I'm going to refresh my chatbot to test things out.

Hit the refresh button at the top right of the chatbot test pane.

Now walk through the workflow to see if it works.

And we can check to see if we received an email (which we did).

And we can see if our spreadsheet was updated (which it was).

Great! Our chatbot has a few basic functions and is ready for primetime.

6. Publishing

To look at options for publishing your chatbot, you can go to the "Channels" tab and explore the options available. Microsoft has walkthroughs for each channel you might be interested in.

For me, since we're publishing to a website, i simply select "Custom Website" and Microsoft gives me the HTML code to add to whatever website builder I'm using. The code will embed the Microsoft chatbot into the site.

That's it for part 2! Lots of nuance, but feels great to have a feel for how the Microsoft suite works and to feel confident that with enough forethought, we can build a fairly robust Microsoft agent with access to a variety of Microsoft’s tools and features.

Best of luck! We’ll talk again on Friday.

-Patrick

Enjoy this? Please take the time to forward to a friend or subscribe.