Exercise - Create and manage topics

Completed

Here, you create the conversational flow for your copilot.

Create a topic using Copilot

Topics can be created and edited using natural language.

  1. Navigate to Microsoft Copilot Studio.

    Important

    Make sure that you're in the correct environment.

  2. Select your copilot in the Copilot pane on the left-hand side of the screen.

  3. Select the Topics tab.

  4. Select Add a topic and select Create from description with Copilot.

    Screenshot of create from description with copilot option.

  5. A new window appears asking you to Name your topic and provide a description in the Create a topic to... text field.

  6. In the Name your topic field, enter the following text:

    Customer Details

  7. In the Create a topic to... field, enter the following text:

    Ask the customer for their name and email address

  8. Select Create.

  9. A new topic displays with the generated trigger phrases and question nodes.

    Note

    Remember, your generated content might appear differently than what's shown in this lab.

  10. Select Save.

Update nodes with natural language

  1. If the Edit with copilot pane isn't shown on the right-hand side of the screen, select the Copilot icon in the upper part of the authoring canvas.

  2. Select the second question node, What is your email address?

  3. In the Edit with Copilot panel, in the What do you want to do? field, enter the following text:

    Update the message in this question node to say thank you to the Name variable from the previous node and then proceed to ask the email address question

  4. Select Update.

    Note

    The message should be updated to include the Name variable from the message node before it.

  5. Select Save.

Add nodes with natural language

In addition to adding updating existing nodes, you can use Copilot to add new ones.

  1. Make sure that no node is selected by clicking in the empty space around the nodes.

  2. In the Edit with Copilot panel, in the What do you want to do? field, enter the following text:

    Summarize the information collected in an adaptive card

  3. Select Update.

  4. A message node with an Adaptive Card is added to the end of the topic.

    Screenshot of the message node with an Adaptive Card.

  5. Select the Adaptive Card. The Adaptive Card properties should appear on the right of the screen.

    Screenshot of the Adaptive Card properties.

    Your Adaptive Card formula should look similar to the one in the previous image. If it doesn't, then you can copy and paste in the following formula:

     {
     type: "AdaptiveCard", 
         body: 
         [
             {
                 type: "TextBlock",
                 size: "Medium",
                 weight: "Bolder",
                 text: "Summary"    
             },
             {
                 type: "FactSet",
                 facts: 
                 [
                     {
                         title: "Full Name",
                         value: Text(Topic.Name)
                     },
                     {
                         title: "Email Address",
                         value: Text(Topic.EmailAddress)
                     }
                 ]
             },
             {
                 type: "TextBlock",
                 text: "Thank you for providing the information."
             }
         ]
     }
    
  6. Opening the Adaptive Card properties closes the Edit with Copilot panel; therefore, you need to select the icon to reopen it.

  7. Make sure that no node is selected by clicking in the empty space around the nodes.

  8. In the What do you want to do? field, enter the following text:

    Add a new multiple choice question to prompt the user if the details are correct with two options Yes or No

  9. Select Update.

  10. A new question node is added to the end of the topic with options for the user to select.

  11. Select Save.

Configure the scope of the variables

  1. Select Variables to open the Variables pane.

    Screenshot of the variables pane.

  2. Select the right-hand check boxes for the topic variables.

  3. Select Save.

Author topics manually

Topics can be created manually by adding trigger phrases and nodes.

Create a topic from blank

  1. Select the Topics tab.

  2. Select Add a topic and select Create from blank.

  3. Select Details to open the Topic details dialog.

    Screenshot of the topic details dialog.

  4. In the Name field, enter the following text:

    Book a Real Estate Showing

  5. In the Display Name field, enter the following text:

    Book

  6. In the Description field, enter the following text:

    Select the property and requested date and create a booking request

  7. Select Save.

  8. Select Details to close the Topic details dialog.

Add trigger phrases

  1. Select Edit under Phrases in the Trigger.

    Screenshot of the topic trigger phrases pane.

  2. Enter I want to book a real estate showing under Add Phrases and select the + icon.

  3. Enter Schedule a real estate showing under Add Phrases and select the + icon.

  4. Enter Arrange the viewing for a real estate property under Add Phrases and select the + icon.

  5. Enter Set up an appointment to view a house under Add Phrases and select the + icon.

  6. Enter Plan a property viewing under Add Phrases and select the + icon.

  7. Select Save.

Add a message node

  1. Select the the + icon under the Trigger node and select Send a message.

    Screenshot of adding a node.

  2. In the Enter a message field, enter the following text:

    Hi, I can help you with booking a real estate property showing.

  3. Select Save.

Add a Topic management node

  1. Select the the + icon under the send a message node and select Add a condition.

  2. Select the DetailsCorrect variable.

  3. Select Go to another topic and select the Customer Details topic.

  4. Select Save.

Add condition node

  1. Select the the + icon under the topic management node and select Add a condition.

  2. In the Enter a message field, enter the following text:

    Which property do you want to see?

  3. Select DetailsCorrect for variable.

  4. Select is equal to

  5. Select Yes.

  6. Select Save.

Add question nodes

  1. Select the the + icon under the left-hand condition node and select Ask a question.

  2. In the Enter a message field, enter the following text:

    Which property do you want to see?

  3. Select User's entire response for Identify.

  4. Select the variable in Save user response as and enter PropertyName for Variable name

  5. Select Save.

  6. Select the the + icon under the question node and select Ask a question.

  7. In the Enter a message field, enter the following text:

    What date and time do you want to see the property?

  8. Select Date and Time for Identify.

  9. Select the variable in Save user response as and enter DateTime for Variable name

  10. Select Save.

Test the copilot

  1. Select the Test button in the top-right of the screen to open the testing panel.

  2. Select the three dots at the top of the testing panel in the top-right of the screen.

  3. Select Track between topics.

  4. Select the Start a new conversation icon at the top of the testing panel.

  5. When the Conversation Start message appears, your copilot starts a conversation. In response, enter a trigger phrase for the topic that you created:

    I want to book a real estate showing

  6. The copilot responds with the "What is your name?" question, as shown in the following image.

  7. Enter the following information:

    Name: <Your name>
    Email address: <Your email address>
    
  8. After you supply the information, an Adaptive Card displays the information that you entered, a question asking if the information is correct, and options to select Yes or No.

  9. Select Yes.

  10. Enter 555 Oak Lane, Denver, CO 80203 to the Which property to you want to see? prompt.

  11. Enter Tomorrow 10:00 AM to the What date and time do you want to see the property? prompt.

Use entities to improve the copilot

Microsoft Copilot Studio uses entities to understand user intent. There are many prebuilt entities included for commonly used information. You can create custom entities for your specific purpose.

View prebuilt entities

  1. Select Settings in the top-right of the screen.

  2. Select the Entities tab.

Create the property type entity

  1. Select + Add an entity and select + New entity.

  2. Select the Closed list tile.

  3. Enter Property Type in the Name field.

  4. Enter Apartment in the Enter item field and select Add.

  5. Enter Condominium in the Enter item field and select Add.

  6. Enter Duplex in the Enter item field and select Add.

  7. Select + Synonyms for Apartment, enter Flat, then select the + icon and select Done.

  8. Select + Synonyms for House, enter Single-family home, then select the + icon and select Done.

  9. Select + Synonyms for Condominium, enter Townhouse, then select the + icon and select Done.

  10. Select Save.

  11. Select Close.

Create number of bedrooms entity

  1. Select + Add an entity and select + New entity.

  2. Select the Regular expression (Regex) tile.

  3. Enter Number of Bedrooms in the Name field.

  4. Enter [1-5] in the Pattern field.

  5. Select Save.

  6. Select Close.

Use entities

  1. Select your copilot in the Copilot pane on the left-hand side of the screen to return to the Overview tab.

  2. Select the Topics tab.

  3. Select the Book a Real Estate Showing topic.

  4. Select the the + icon above the property question node and select Ask a question.

  5. In the Enter a message field, enter the following text:

    What type of property do you want to see?

  6. Select Property Type for Identify.

  7. Select Select options for user and check the Display option for all list values.

  8. Select the variable in Save user response as and enter PropertyType for Variable name

  9. Select the the + icon below the new question node and select Ask a question.

  10. In the Enter a message field, enter the following text:

    How many bedrooms do you need?

  11. Select Number of Bedrooms for Identify.

  12. Select the variable in Save user response as and enter NumberofBedrooms for Variable name

  13. Select Save.

Create Copilot actions

Microsoft Copilot Studio can access data in Microsoft Dataverse using Power Automate cloud flows

Create Power Automate flow to retrieve a property

  1. Select your copilot in the Copilot pane on the left-hand side of the screen to return to the Overview tab.

  2. Select the Actions tab.

  3. Select + Add an action.

  4. Scroll down and select Create a new flow.

  5. Sign in to Power Automate if prompted.

  6. Select Run a flow from Copilot in the top-left of the screen and enter Get Property as the flow name.

  7. Select the trigger step Run a flow from Copilot and select + Add an input.

  8. Select Text.

  9. Enter Bedrooms for Input and Number of Bedrooms for Please enter your input.

  10. Select the + icon between the two steps in the flow and select Add an action.

  11. Enter Dataverse in the Search field and select See more for the Dataverse connector.

  12. Select the List rows action.

  13. If prompted for authentication, select OAuth and select Sign in.

  14. Select Real Estate Properties for table name.

  15. Select Show all.

  16. Enter contoso_bedrooms eq in the Filter Rows field.

  17. Use Dynamic content to select the Bedrooms parameter and select Add.

  18. Select the Respond to Copilot action and select + Add an output.

  19. Select Text.

  20. Enter PropertyId for Enter a name, select into the Enter a value to respond with field, and select Insert Expression.

  21. Enter the following expression:

    first(outputs('List_rows')?['body/value'])['contoso_realestatepropertyid']
    
  22. Select Add.

  23. Select + Add an output.

  24. Select Text.

  25. Enter PropertyName for Enter a name, select into the Enter a value to respond with field, and select Insert Expression.

  26. Enter the following expression:

    first(outputs('List_rows')?['body/value'])['contoso_propertyname']
    
  27. Select Add.

  28. Select Settings.

  29. Ensure that Asynchronous Response is set to Off.

  30. Select Save draft.

  31. Select Publish.

  32. Close the Power Automate tab.

Add a Copilot action for retrieving a property

  1. Select Refresh.

  2. Select the Get Property flow.

  3. Select Next.

  4. Select Next.

  5. Select Finish.

  6. Select the Topics tab.

  7. Select the Book a Real Estate Showing topic.

  8. Select the the + icon below the How many bedrooms do you need question? node and select Call an action.

  9. Select the Get Property flow.

  10. Select the NumberofBedrooms variable for the Bedrooms input parameter.

  11. Select the three dots in the Which property do you want to see? question node and select Delete.

  12. Select the the + icon under the action node and select Send a message.

  13. In the Enter a message field, enter the following text:

    Property

  14. Select the Insert variable icon and select the PropertyName variable.

  15. Select Save.

  16. Select Publish and select Publish.

Create Power Automate flow to make a booking

  1. Select your copilot in the Copilot pane on the left-hand side of the screen to return to the Overview tab.

  2. Select the Actions tab.

  3. Select + Add an action.

  4. Scroll down and select Create a new flow.

  5. Select Run a flow from Copilot in the top-left of the screen and enter Create Booking Request as the flow name.

  6. Select the trigger step Run a flow from Copilot and select + Add an input.

  7. Select Text.

  8. Enter PropertyId for Input and Property for Please enter your input.

  9. Select + Add an input.

  10. Select Text.

  11. Enter ViewerName for Input and Viewer Name for Please enter your input.

  12. Select + Add an input.

  13. Select Text.

  14. Enter ViewerEmail for Input and Viewer Email for Please enter your input.

  15. Select the + icon between the two steps in the flow and select Add an action.

  16. Enter Dataverse in the Search field and select See more for the Dataverse connector.

  17. Select the Add a new row action.

  18. Select Booking Requests for table name.

  19. Select Show all.

  20. Enter Copilot booking in the Booking Name field.

  21. Enter contoso_bookingrequests() in the Property (Real Estate Properties) field, move the cursor within the brackets, and use Dynamic content to select the PropertyId parameter.

  22. Use Dynamic content to select the ViewerName parameter for the Viewer Name field.

  23. Use Dynamic content to select the ViewerEmail parameter for the Viewer Email field.

  24. Select the Respond to Copilot action.

  25. Select Settings.

  26. Ensure that Asynchronous Response is set to Off.

  27. Select Save draft.

  28. Select Publish.

  29. Close the Power Automate tab.

Add a Copilot action for creating a booking request

  1. Select Refresh.

  2. Select the Create Booking Request flow.

  3. Select Next.

  4. Select Next.

  5. Select Finish.

  6. Select the Topics tab.

  7. Select the Book a Real Estate Showing topic.

  8. Select the the + icon below the What date and time do you want to see the property? node and select Call an action.

  9. Select the Create Booking Request flow.

  10. Select the PropertyId variable for the PropertyId input parameter.

  11. Select the Name variable for the ViewerName input parameter.

  12. Select the EmailAddress variable for the ViewerEmail input parameter.

  13. Select the the + icon below the action node. Select Topic management, then select Go to another topic and select End of conversation.

  14. Select Save.

  15. Select Publish and select Publish.

Test the copilot and make a booking request

  1. Select the Test button in the top-right of the screen to open the testing panel.

  2. Select the three dots at the top of the testing panel in the top-right of the screen.

  3. Select Track between topics.

  4. Select the Start a new conversation icon at the top of the testing panel.

  5. When the Conversation Start message appears, your copilot starts a conversation. In response, enter a trigger phrase for the topic that you created:

    I want to book a real estate showing

  6. Enter the following information:

    Name: <Your name>
    Email address: <Your email address>
    
  7. After you supply the information, an Adaptive Card displays the information that you entered, a question asking if the information is correct, and options to select Yes or No.

  8. Select Yes.

  9. Select House for the type of property prompt.

  10. Enter 2 for the number of bedrooms prompts.

  11. Enter Tomorrow 2:00 PM to the What date and time do you want to see the property? prompt.

  12. Select Yes to the Did that answer your question? prompt.

  13. Select any rating.

  14. Select No to the Can I help with anything else? prompt.

Verify booking request

  1. Navigate to the Power Apps maker portal.

  2. In the left navigation pane, select Tables and select Custom.

  3. Select the Booking Request table.

  4. Under Booking Request columns and data you should see that a Copilot booking request is now created.