Table of Contents
Introduction
In this blog, we will walk through the process of creating a custom Cafeteria Feedback Copilot using Copilot Studio. This Copilot will analyze user feedback using the AI Prompt action, perform sentiment analysis, automatically escalate negative feedback, and store positive feedback in Dataverse.
Process Flow
- User Interaction: The user initiates the conversation with the Copilot by providing feedback about the cafeteria.
- Automatic Topic Selection: Based on the user’s input, the Copilot automatically detects the relevant topic and directs the conversation accordingly.
- Feedback Collection: The user is presented with an adaptive card to input specific details such as the date and their feedback.
- Sentiment Analysis: Once the feedback is submitted, the Copilot uses an AI Prompt action to analyze the sentiment of the feedback in real-time.
- Action Based on Sentiment:
- Negative Feedback: If the sentiment is negative, the feedback is escalated to the concerned team via email, and the details are logged in Dataverse.
- Positive Feedback: If the sentiment is positive, the feedback is simply logged in Dataverse.
- User Confirmation: The user receives a confirmation message indicating the action taken on their feedback.
This process ensures a seamless and responsive interaction where the user’s feedback is promptly analyzed and acted upon.
Prerequisites
- Access to Copilot Studio.
- Dataverse configured for storing feedback.
- AI Builder Credits for using AI Prompt Action
- Images stored in a location like Azure Blob Storage which can be used in Adaptive Cards
Demo
Watch the demo video below to see how the Smart Feedback Analyzer works.
Step 1 : Create the Dataverse Table
We will be storing the positive and negative feedbacks in the dataverse table named RestaurantFeedbacks
which contains the columns Feedback
,Feedback Date
,Sentiment
Step 2: Create the Custom Copilot
-
Head over to Copilot Studio and click on Create.
-
You will have the option to create a copilot based on an existing template or create a blank copilot from scratch. Let’s select New copilot.
-
This will take you to the page where you can:
- Describe the copilot functionality and provide any specific instructions.
- Click on Create to provision the copilot.
Step 3: Enable Generative Selection of Topics
- The copilot is now created. Next, we need to make some configuration changes.
- Click on Edit to update the copilot’s name, icon, and description.
- Click on Settings to enable the Generative selection of topics so that topics are auto-selected based on user conversations, resulting in a smoother user experience.
- To enable the automatic detection of topics from user interaction:
- Click on Generative AI.
- Select Generative.
- Click on Save to update the settings.
- Click on the Close icon to return to the home page of this custom copilot.
Step 4: Create Topics
- Now, let’s go ahead and create the topics that will automatically redirect the conversation flow to appropriate topics based on the user’s questions.
- Click on Topics from the navigation menu.
- Click on Add a Topic.
- You can either create a blank topic or use Copilot to create the topic with an initial set of prepopulated conversation nodes based on the topic description.Select Create from description with Copilot.
-
Let’s provide the topic description details in the pop-up that appears.
-
Click on Create to provision the topic skeleton based on the provided description.
Thus, we have the basic topic created with an automatic trigger. Now, let’s add an adaptive card to accept the user input, such as feedback date and cafeteria feedback.
We will add the below adaptive card JSON schema to the Adaptive Card Node Properties as shown below.
{ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "type": "AdaptiveCard", "version": "1.4", "backgroundImage": { "url": "https://adaptivecardsbot.blob.core.windows.net/imagestore/108265.jpg", "fillMode": "cover", "horizontalAlignment": "center", "verticalAlignment": "center" }, "body": [ { "type": "Container", "backgroundColor": "#E0FFFF", "items": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "auto", "items": [ { "type": "Image", "url": "https://adaptivecardsbot.blob.core.windows.net/imagestore/cafeteria.png", "size": "Small", "horizontalAlignment": "Left" } ] }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Cafeteria Food Feedback", "weight": "Bolder", "size": "Large", "wrap": true, "horizontalAlignment": "Left", "color": "Default", "spacing": "Medium" } ] } ] } ], "style": "emphasis", "bleed": true, "spacing": "None" }, { "type": "TextBlock", "text": "Please provide your feedback for the food served today.", "wrap": true, "weight": "Bolder", "color": "Good", "spacing": "Medium" }, { "type": "TextBlock", "text": "Date", "weight": "Bolder", "wrap": true, "spacing": "Small" }, { "type": "Input.Date", "id": "feedbackDate", "placeholder": "dd-mm-yyyy" }, { "type": "TextBlock", "text": "Your Feedback", "weight": "Bolder", "wrap": true, "spacing": "Small" }, { "type": "Input.Text", "id": "feedbackText", "isMultiline": true, "placeholder": "Enter your feedback here...", "maxLength": 500 } ], "actions": [ { "type": "Action.Submit", "title": "Submit Feedback" } ], "style": "default" }
-
As we can see, the user inputted values for date and feedback are stored in the
feedbackDate
andfeedbackText
variables, which we will use later.
Step 5: Add AI Prompt Action
- Now, let’s add the AI Prompt action:
- Select Call an action.
- Click on Basic Actions.
- Select Create a prompt.
- This will open a pop-up window where we can define the prompt. We will:
- Provide a name for the prompt (e.g., Cafeteria Feedback Analyzer) so that we can later select it by this name.
- Create an input with the name Feedback so that we can dynamically pass the user input to this variable.
- Add the prompt that will analyze the feedback in the Prompt section and click on Insert to add the
Feedback
variable to the prompt. - Click on Save custom prompt to make it available in the Copilot canvas.
- Now we can add the prompt to the conversation flow by selecting its name:
- Select Call an action.
- From Basic Actions, search for the recently created prompt by its name.
- Select the Cafeteria Feedback Analyzer prompt.
-
Select the
feedbackText
variable, which contains the user inputted feedback, and assign it as the input to the Prompt action. -
We will also define a variable (
feedbackSentiment
) to hold the output of the AI Prompt action so that we can check the sentiment of the user feedback and take action on it.
Step 6: Escalate Negative Feedback
-
Now, let’s add a condition to check whether the feedback analyzed by the AI Prompt action is negative or positive by adding the condition node.
-
Since
feedbackSentiment
is a record variable, we need to get thefeedbackSentiment.text
property, which contains the feedback analysis value. We will then check if it is negative and, if so, escalate the feedback to the concerned users. -
To escalate the feedback, let’s add an Office 365 Mail action:
- Select Call an action.
- From the Connector tab, search for Office 365 Mail connectors.
- Select Send an email (V2) action.
-
Now, configure the Office 365 Mail connector:
- Set the To and Escalation Subject fields.
- In the Body, add the mail content and concatenate it with the user feedback present in the
feedbackText
variable using the Concatenate expression. - Add an output variable to the Connector action.
Step 7: Save Feedback to Dataverse
- Once escalated, let’s save the negative feedback to the Dataverse backend using the Connector action:
- Select Call an action.
- From the Connector actions tab, search for the Dataverse connector.
- Select the Add a new row to the selected environment connector.
- Now, configure the Dataverse connector action:
- Set the environment and table name.
- Select the
feedbackText
variable, which contains the User Feedback. - Select Advanced inputs to add the remaining data that needs to be saved.
-
Add additional inputs like Feedback Date and Feedback Sentiments retrieved from the AI prompt action to save them to Dataverse.
-
We will also add an image to provide the user confirmation that the feedback has been escalated to the concerned individuals.
- In the positive branch of the condition, let’s repeat the same steps to save the positive feedback to Dataverse:
- Select Call an action.
- From the Connector actions tab, search for the Dataverse connector.
- Select the Add a new row to the selected environment connector.
- Now, configure the Dataverse connector action:
- Set the environment and table name.
- Select the
feedbackText
variable, which contains the User Feedback. - Select Advanced inputs to add the remaining data that needs to be saved.
-
Add additional inputs like Feedback Date and Feedback Sentiments retrieved from the AI prompt action to save them to Dataverse.
-
We will also add an image to provide the user confirmation that the feedback has been saved.
Step 8: Publish the Copilot
- We have now completed the Copilot development. Let’s deploy this in Teams so that employees can start using it.
- Select Channels and select Microsoft Teams.
- Select Turn on Teams to enable Teams publishing channel.
-
Now we have the option to edit the Copilot icon, details, and description that will be shown in Teams. Once done, Click on Availability options.
-
We have different ways to publish the Copilot to Teams. We can download and upload the Zip to use the Copilot as a personal app, but we will publish it to the whole organization.
-
Select Submit for admin approval so that the app can be approved by the admin from the Teams admin center.
-
We can see that the app has come up for approval in the admin center. Let’s approve it.
-
It would take some time for the app to be globally published. Once available, let’s search for the app from the Teams store and add it for our use.
-
We will initiate the conversation with the copilot, and it provides the adaptive card for providing the feedback details.
-
The feedback has been submitted, and we get a success message indicating the escalation process has been initiated.
-
If we head to the Dataverse, we can see that the feedback has been logged.
-
We can also see that the escalation mail has reached the concerned team.
-
Now, let’s test with positive feedback.
-
The feedback has been submitted, and we get a positive feedback success message.
-
If we check Dataverse, we can see that the positive feedback has also been logged.
Summary
In this blog, we have walked through the process of developing a Cafeteria Feedback Copilot that uses AI Prompt action to perform sentiment analysis on the fly and take appropriate actions based on the sentiment. This copilot can be a powerful tool for automating feedback analysis and ensuring prompt responses to user feedback in an organization.