Create an Azure Health Bot tutorial header image

Create AI-powered medical chatbots with Azure Health Bot

In this article, you will build your first intelligent, AI-powered, medical chatbot using Azure Health Bot. You will learn how to:

  • Create and configure an Azure Health Bot instance using the Azure portal.
  • Deploy a Web Chat channel.
  • Embed a Web Chat in a web page.

To complete the exercise, you will need:

  • An Azure subscription. If you don’t already have one, you can sign up for an Azure free account.

Create an Azure Health Bot instance

  1. Sign in to Azure Portal and search for Azure Health Bot.
    In the Azure portal search for Azure Health Bot
  2. Then select Create to start.
  3. Configure the new resource. Select subscription, resource group, name, region (for example, East US) and plan. You can start with the Free (F0) plan and select another plan later. Then click Review + Create.
    Details for the new Azure Health Bot resource
  4. Wait for the deployment to be complete (it may take several minutes) and then select Go to resource.
  5. Click on the Management portal link to go to your Azure Health Bot management portal.
    Click on the Azure Health Bot Management portal link

Explore the bot

Before extending our bot, let’s explore the available features of our health bot instance.

Built-in Scenarios

Built-in scenarios are prebuilt scenarios that are available to your users. They perform important tasks, such as triaging and symptom checking, answering questions or providing information about medical conditions and symptoms or types of drugs. Additionally, the Azure Health Bot provides a few built-in commands that may help you interact with your bot. You can try the built-in capabilities of your bot using the web chat.

  1. In the upper menu, select the chat icon.
  2. Use some of the following phrases to trigger different built-in scenarios:
    • I have a headache
    • Information about arthritis
    • What are the symptoms of diabetes?
    • Resources for malaria

    If you want to force a scenario to end, use the Cancel command.

    Preview of the triage and symptom checking scenario in the web chat
  1. Type Help to see all the available built-in commands.
    Type Help in the web chat to see a list of all the available built-in commands
  2. Type What do you know to see what the bot has learned about you.
    Type What do you know to see what the bot has learned about you.
Custom scenarios

You can extend your bot by authoring your own scenarios. To create a new scenario, navigate to the Scenarios tab and click Create new scenario. You can build your scenarios using a drag-and-drop visual interface called Designer or using code. In the next article, you will learn how to create a custom scenario for mental health screening.

How to create a new custom scenario

Create the Web Chat channel

The Web Chat is a web application that the end users can use to communicate with your Azure Health Bot instance. The web chat channel is enabled by default. Additional channels can be enabled for your bot through the Health Bot management portal. Learn more about how to connect your bot to channels.

  1. In the Health Bot management portal, navigate to Integration > Secrets. Copy the APP_SECRET and the WEBCHAT_SECRET.
    App service and webchat secrets
  2. Go to the Health Bot Container GitHub repository and select Deploy to Azure.
  3. Provide the details required to provision the new web app.
    • Subscription: The Azure subscription that will be charged.
    • Resource group: Create a new group or use an existing group.
    • App Secret: Use the APP_SECRET copied in step 1.
    • Webchat Secret: Use the WEBCHAT_SECRET copied in step 1.
    Provision the new web app
  4. Click Review + Create. Once the deployment is complete, select Go to resource group.
  5. Two new services have been created in the resource group: an App Service and an App Service Plan. Select the App Service and then open the URL to test the deployed web chat.
    Open the web app URL to navigate to the deployed web chat
  6. Type “I have a headache” to trigger the triage and symptom checking scenario.
    The deployed web chat

Embed a Web Chat in your web page

You can use the deployed web page to embed the web chat in your website.

  1. Download the website-template from my GitHub repository or use your own website.
  2. Open the file in Visual Studio Code and embed the web chat in your website using an iFrame.
<div class="bot-container">
    <iframe src="https://healthcare-bot.azurewebsites.net/" width="500" height="500">
</div>
  1. Navigate to the website and see the web chat.
    A simple website with the web chat embeded

Next steps

In this article, you explored the capabilities of Azure Health Bot and learned how to create your own Health Bot instance and deploy the Web Chat channel. In the next article, you will learn how to create a custom scenario for mental health screening and a language model.

Clean-up

If you have finished exploring Azure Health Bot, you can delete your health bot instance and associated resources.

  1. In the Azure portal, select Resource groups on the right menu and then select the resource group that you have created.
  2. Click Delete resource group.

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top