Skip links

How to build a chatbot with Power Automate and Power Virtual Agents

Chatbots are becoming more popular as a way to provide customer service, answer frequently asked questions, and automate tasks. However, building a chatbot from scratch can be challenging and time-consuming. Fortunately, Microsoft offers two tools that can help you create a chatbot without coding: Power Automate and Power Virtual Agents.

Power Automate is a cloud-based service that allows you to create workflows and automate tasks across various applications and services, such as Outlook, SharePoint, Teams, and Twitter. Power Virtual Agents is a low-code platform that enables you to design and deploy conversational agents that can interact with users through natural language.

In this tutorial, we will show you how to use Power Automate and Power Virtual Agents to build a chatbot that can book appointments for a dental clinic. The chatbot will ask the user for their name, phone number, email address, and preferred date and time for the appointment. Then, it will use Power Automate to send an email confirmation to the user and update a SharePoint calendar with the appointment details.

To follow this tutorial, you will need:

– A Microsoft 365 account

– Access to Power Automate and Power Virtual Agents

– A SharePoint site with a calendar list named “Appointments”

1. Create a new bot in Power Virtual Agents.

2. Define the trigger phrases that will start the chatbot conversation.

3. Create a topic for booking appointments and add the questions and actions for the chatbot.

4. Use Power Automate to create a flow that will send an email confirmation and update the SharePoint calendar.

5. Test and publish the chatbot.

Let’s get started!

Create a new bot in Power Virtual Agents

– To create a new bot in Power Virtual Agents, go to [URL] and sign in with your Microsoft 365 account.

– Click on the “Create a bot” button and choose a name and location for your bot. For this tutorial, we will name our bot “DentalBot”.

– Wait for a few minutes until your bot is ready. You will see a dashboard with some pre-built topics and analytics for your bot. Topics are the main scenarios that your chatbot can handle, such as greeting, chitchat, escalation, etc.

Define the trigger phrases that will start the chatbot conversation

– To define the trigger phrases that will start the chatbot conversation, click on the “Topics” tab on the left side of the dashboard.

– Click on the “New topic” button and enter a name for your topic. For this tutorial, we will name our topic “BookAppointment”.

– In the “Trigger phrases” section, enter some sentences that users might say to book an appointment, such as:

– I need to make an appointment

– Can I book a visit?

– How do I schedule a check-up?

– You can add up to 20 trigger phrases per topic. The more trigger phrases you add, the more likely your chatbot will recognize the user’s intent and start the conversation.

– Click on the “Save” button to save your topic.

Create a topic for booking appointments and add the questions and actions for the chatbot

– To create a topic for booking appointments and add the questions and actions for the chatbot, click on the “BookAppointment” topic that you just created.

– You will see a canvas where you can design the chatbot conversation using nodes. Nodes are the building blocks of the chatbot dialogue. They can be of different types, such as question, message, action, condition, etc.

– To start the conversation, drag and drop a “Message” node from the toolbar on the right side of the canvas. This node will display a greeting message to the user when they trigger the topic.

– Double-click on the node and enter the message text, such as “Hello, I’m DentalBot, your virtual assistant. I can help you book an appointment with our dental clinic. Are you interested?”

– To add a question node that will ask the user for their name, drag and drop a “Question” node from the toolbar and connect it to the message node.

– Double-click on the question node and enter the question text, such as “What is your name?”

– In the “Answer type” section, choose “Text” from the drop-down menu. This will allow the chatbot to accept any text input from the user.

– In the “Variable name” section, enter a name for the variable that will store the user’s answer, such as “userName”. Variables are placeholders that can be used to store and retrieve information throughout the chatbot conversation.

– To add more question nodes that will ask the user for their phone number, email address, and preferred date and time for the appointment, repeat the same steps as above, but change the question text, answer type, and variable name accordingly. For example, you can use the following question texts, answer types, and variable names:

– What is your phone number? (Answer type: Number, Variable name: userPhone)

– What is your email address? (Answer type: Email, Variable name: userEmail)

– When would you like to visit us? (Answer type: Date, Variable name: userDate)

– What time do you prefer? (Answer type: Time, Variable name: userTime)

– To add a message node that will confirm the user’s appointment details, drag and drop a “Message” node from the toolbar and connect it to the last question node.

– Double-click on the message node and enter the message text, such as “Thank you for providing your information. You have booked an appointment with us on {userDate} at {userTime}. We will send you an email confirmation shortly.”

– To use the variables in the message text, enclose them in curly brackets, such as {userDate} and {userTime}. This will display the actual values that the user entered in the chatbot conversation.

Use Power Automate to create a flow that will send an email confirmation and update the SharePoint calendar

– To use Power Automate to create a flow that will send an email confirmation and update the SharePoint calendar, click on the “Call an action” button on the toolbar and drag and drop an “Action” node from the toolbar and connect it to the message node.

– Double-click on the action node and click on the “Create a flow” button. This will open a new tab where you can create a flow using Power Automate.

– In the Power Automate tab, you will see a trigger called “When a Power Virtual Agents bot calls a Power Automate flow”. This trigger will start the flow when the chatbot reaches the action node in the conversation.

– To pass the variables from the chatbot to the flow, click on the “+ Add input” button and choose “Text” from the drop-down menu. Enter a name for the input, such as “userName”, and click on the “Add” button. Repeat this step for the other variables, such as userPhone, userEmail, userDate, and userTime.

– To add an action that will send an email confirmation to the user, click on the “+ New step” button and search for “Send an email (V2)” in the search box. Choose the action from the list of results.

– In the action settings, enter the following information:

– To: Enter the userEmail input that you created earlier.

– Subject: Enter a subject for the email, such as “Your appointment confirmation”.

– Body: Enter the body of the email, such as “Dear {userName}, thank you for booking an appointment with our dental clinic. Your appointment details are as follows: Date: {userDate}, Time: {userTime}. Please reply to this email if you have any questions or need to reschedule. We look forward to seeing you soon.”

– To use the inputs in the email text, click on the “Dynamic content” button and choose the input from the list of options.

– To add an action that will update the SharePoint calendar with the appointment details, click on the “+ New step” button and search for “Create item” in the search box. Choose the action from the list of results.

– In the action settings, enter the following information:

– Site Address: Enter the URL of your SharePoint site where you have the calendar list named “Appointments”.

– List Name: Choose “Appointments” from the drop-down menu.

– Title: Enter the userName input that you created earlier.

– Start Time: Enter the userDate and userTime inputs that you created earlier, separated by a space. For example, {userDate} {userTime}.

– End Time: Enter the userDate and userTime inputs that you created earlier, separated by a space, and add one hour to the userTime. For example, {userDate} {userTime}+1h. This will create a one-hour appointment slot in the calendar.

– Location: Enter the name of your dental clinic, such as “Dental Clinic”.

– Description: Enter a description for the appointment, such as “Appointment booked by DentalBot”.

– To add a response that will return a success message to the chatbot, click on the “+ New step” button and search for “Return a Power Virtual Agents response” in the search box. Choose the action from the list of results.

– In the action settings, enter a response text, such as “Your appointment has been confirmed and added to our calendar. Have a nice day!”

– Click on the “Save” button to save your flow. Give it a name, such as “BookAppointmentFlow”.

– Go back to the Power Virtual Agents tab and refresh the page. You will see that the action node has been updated with the name of your flow.

Test and publish the chatbot

– To test and publish the chatbot, click on the “Test your bot” button on the bottom right corner of the canvas. This will open a chat window where you can interact with your chatbot and see how it works.

– Try typing some of the trigger phrases that you defined earlier, such as “I need to make an appointment”. The chatbot should greet you and ask you for your name, phone number, email address, and preferred date and time for the appointment. After you provide all the information, the chatbot should confirm your appointment details and call the flow that will send you an email confirmation and update the SharePoint calendar.

– Check your email inbox and your SharePoint calendar to see if the flow worked as expected. You should receive an email with your appointment details and see a new item in the calendar with your name and appointment time.

– If everything works fine, you can publish your chatbot by clicking on the “Publish” button on the top right corner of the canvas. This will make your chatbot available to the users who access your bot’s URL.

Congratulations! You have successfully built a chatbot with Power Automate and Power Virtual Agents that can book appointments for a dental clinic. You can customize your chatbot further by adding more topics, questions, actions, and flows to suit your needs. You can also integrate your chatbot with other channels, such as Teams, Facebook Messenger, or your own website.

For more information,  Contact Sunbridge Software Services.

 www.sunbridgeglobal.com

Leave a comment

Open chat
Hello
Can we help you?
Explore
Drag