Exercise - Create and manage topics

Completed

Here, you create the conversational flow for your agent.

Create a topic using Microsoft 365 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 agent in the Agents 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 agent 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 Microsoft 365 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 updating existing nodes, you can use Microsoft 365 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: "Name", 
                        value: Text(Topic.Name) 
                    }, 
                    { 
                        title: "Email address", 
                        value: Text(Topic.EmailAddress) 
                    } 
                ] 
            } 
        ], 
        '$schema': "http://adaptivecards.io/schemas/adaptive-card.json", 
        version: "1.5"
    }
    
  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.

  2. Select each of the variables and set their Usage values to Global (any topic can access).

    Screenshot of the variables pane.

    Each variable should now show under the Global group in the Variables pane.

  3. Select Save to save the completed topic.

Author topics manually

Topics can also be created manually with highly customizable nodes.

Create a topic from blank

  1. Select the Topics tab.

  2. Select Add a topic and select 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 node.

    Screenshot of the topic trigger phrases pane.

  2. Enter the following phrases under Add Phrases. Select the + icon or press enter to move on to the next phrase.

    • I want to book a real estate showing
    • Schedule a real estate showing
    • Arrange the viewing for a real estate property
    • Set up an appointment to view a house
    • Plan a property viewing
  3. Select Save.

Add a message node

  1. Select 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 for the Condition node.

  3. Under is equal to, set the value to No.

  4. Add a node under the condition and select the Topic Management > Go to another topic node and choose the Customer Details topic.

  5. Select Save.

Add condition node

  1. Select the the + icon under the message node and add another condition by selecting Add a condition.

  2. Select DetailsCorrect for variable.

  3. Under is equal to, set the value to Yes.

Add question nodes

  1. Select the the + icon under the DetailsCorrect is equal to Yes 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 the the + icon under the question node and select Ask a question.

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

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

  7. Select Date and Time for Identify.

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

  9. Select Save to save the topic.

  1. From the Topics tab, open the Customer Details topic.

  2. At the bottom of the topic, under the Are these details correct? Question node, add a topic redirect node to the Book a Real Estate Showing topic.

  3. Save the topic.

Test the agent

  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 agent starts a conversation. In response, enter a trigger phrase for the topic that you created:

    Customer info

  6. The agent responds with the "What is your name?" question, then enter your name.

  7. The agent should now respond with "What is your email address?", then enter 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 agent

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 House in the Enter item field and select Add.

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

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

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

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

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

  11. Select Save.

  12. 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 and exit the entities menu to return back to your Book a Real Estate Showing topic.

Use entities

  1. In the Book a Real Estate Showing topic, select the the + icon above the Which property do you want to see? question node and select Ask a question.

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

    What type of property do you want to see?

  3. Select Property Type for Identify.

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

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

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

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

    How many bedrooms do you need?

  8. Select Number of Bedrooms for Identify.

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

  10. Select Save to save the topic.

Create agent actions

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

Create Power Automate flow to retrieve a property

  1. Navigate to the Actions tab for your agent.

  2. Select + Add an action.

  3. In the Add action window, select the + New action button and choose New Power Automate flow from the list.

  4. Sign in to Power Automate if prompted.

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

  6. In the trigger step named Skills, select + Add an input to add an input variable from your agent.

  7. Select Text.

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

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

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

  11. Select the List rows action.

  12. Sign in if prompted for authentication.

  13. Select Real Estate Properties for table name.

  14. Enter contoso_bedrooms eq in the Filter Rows field.

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

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

  17. Select Text.

  18. Enter PropertyId for Enter a name, select the Enter a value to respond with field, and select the Expression tab in the Dynamic content window.

  19. Enter the following expression:

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

  21. Select + Add an output.

  22. Select Text.

  23. Enter PropertyName for Enter a name, select into the Enter a value to respond with field, and select the Expression tab in the Dynamic content window.

  24. Enter the following expression:

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

  26. Navigate to the Settings for the Respond to Copilot action.

  27. Ensure that Asynchronous Response is set to Off.

  28. Select Save to save the flow.

  29. Close the Power Automate tab.

Add an agent action for retrieving a property

  1. In the tab that still has your agent open, select Refresh.

  2. Select the Get Property flow.

  3. In the configure menu for the Get Property flow, select Add action to add it as an action to your agent.

  4. Navigate to the Topics tab.

  5. Select the Book a Real Estate Showing topic.

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

  7. Select the Get Property flow.

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

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

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

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

    Property

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

  13. Save and Publish the topic.

Create Power Automate flow to make a booking

  1. Navigate to the Actions tab in your agent.

  2. Select + Add an action.

  3. Select the + New action button and choose New Power Automate flow from the list.

  4. Make sure the New designer toggle is set to On in the top-right corner of the Power Automate flow designer.

  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. Enter Agent booking in the Booking Name field.

  20. Select Show all next to Advanced parameters.

  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 an agent action for creating a booking request

  1. Navigate back to the browser tab with your agent open and select Refresh.

  2. Select the Create Booking Request flow.

  3. Select Add action at the bottom of the configure action window to add the action to your agent.

  4. Select the Topics tab.

  5. Select the Book a Real Estate Showing topic.

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

  7. Select the Create Booking Request flow.

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

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

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

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

  12. Save the topic and Publish the agent.

Test the agent 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 agent starts a conversation. In response, enter a trigger phrase for the topic that you created:

    Customer info

  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 an agent booking request is now created.