DEV Community

Cover image for Building a Smart Feedback Agent with Copilot Studio, Adaptive cards and Power Automate
Seena Khan
Seena Khan

Posted on

Building a Smart Feedback Agent with Copilot Studio, Adaptive cards and Power Automate

Introduction to Building a Smart Feedback Agent

In today's digital landscape, providing seamless and intelligent feedback mechanisms is crucial for improving user experiences. By leveraging Copilot Studio, Adaptive Cards, and Power Automate, you can create a smart feedback agent that not only interacts with users but also collects and processes feedback efficiently.

Microsoft Copilot Studio

Copilot Studio is a powerful tool that allows you to build, test, and deploy conversational agents using natural language. With its intuitive interface, you can create agents that understand and respond to user queries, making the interaction more human-like and engaging.

Adaptive Cards

Adaptive Cards are a way to present and collect information in a visually appealing and interactive manner. By integrating Adaptive Cards into your feedback agent, you can gather user feedback seamlessly after each interaction. This ensures that the feedback process is smooth and non-intrusive.

Power Automate

Power Automate enables you to automate workflows and processes. By connecting your feedback agent with Power Automate, you can automate the collection, analysis, and response to user feedback. This integration helps in streamlining the feedback loop and ensures timely responses and improvements.

This blogpost will lead you through the process of creating a feedback agent with interactive adaptive cards and sending the feedback results to the relevant person using Power Automate. Ideal for enhancing organizational efficiency and user engagement. Check out as we configure our copilot to gather input using an adaptive card and send feedback emails to the relevant person using Power Automate.

Lets do it!!!

Step 1. Create a feedback agent by using Microsoft Copilot Studio

  • Login into Microsoft Copilot Studio and select your environment. Select +Create. Then select New agent.

Image description

  • Enter the name as Feedbacks Service Agent. On the description box please enter the following description. This feedback agent collects user feedback after each interaction with the system. It uses Adaptive Cards to prompt users for their feedback on the quality and relevance of the responses they received. The feedback is then analyzed to identify areas for improvement and enhance the overall user experience.
  • Enter the following instructions at the instruction box. Role: You are a feedback agent responsible for collecting user feedback after each interaction. Format: Collect feedback in a structured format with fields for 'Overall Experience', 'Suggestions for Improvement', and 'Additional Comments'. Use a friendly and encouraging tone. Context: Ask for feedback specifically about the accuracy and helpfulness of the responses provided during the interaction. Include questions like -Rate your satisfaction on a scale of 1 to 5' and 'Provide any additional comments. Exclusions: Do not ask for personal information or sensitive data. Adaptive Cards: Use an Adaptive Card to present feedback questions and collect responses. Follow-Up: Send the collected feedback to the designated team for review and analysis.
  • After entering all these details please select Create.

Image description

Step 2. Configure Topics

  • We can enable the orchestration of Generative AI, so that our agent can use generative AI to determine how best to respond to users and events.
    Image description

  • After enbaling Generative AI please select Topics from the top and select first conversation.

Image description

  • We are updating the conversation start message as below:

We hope you had a great experience using our service today. We would love to hear your thoughts and feedback to help us improve. Could you please take a moment to share your experience with us? Here is the form for it.

  • After entered the start message please select Save. Then refresh the Test your agent pane and you can see the start message has been changed there.

Image description

  • Select Add node, then select Ask with Adaptive card.

Image description

  • Click on the Adaptive card node, a sidescree will open with JSON script. Select Open Adaptive Card designer to design our feedback form.

Image description

  • Enter the following JSON script into the Card payload editor. { "type": "AdaptiveCard", "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.0", "body": [{ "type": "TextBlock", "text": "We value your feedback!", "weight": "Bolder", "size": "Medium" }, { "type": "TextBlock", "text": "Name", "weight": "Bolder", "size": "Medium" }, { "type": "Input.Text", "id": "name", "placeholder": "Enter your name" }, { "type": "TextBlock", "text": "Email", "weight": "Bolder", "size": "Medium" }, { "type": "Input.Text", "id": "email", "placeholder": "Enter your emailId" }, { "type": "TextBlock", "text": "Rate your satisfaction", "weight": "Bolder", "size": "Medium" }, { "type": "Input.ChoiceSet", "id": "satisfaction", "style": "expanded", "choices": [ { "title": "1 - Very Dissatisfied", "value": "1" }, { "title": "2 - Dissatisfied", "value": "2" }, { "title": "3 - Neutral", "value": "3" }, { "title": "4 - Satisfied", "value": "4" }, { "title": "5 - Very Satisfied", "value": "5" } ] }, { "type": "Input.Text", "id": "comments", "placeholder": "Additional comments", "isMultiline": true } ], "actions": [ { "type": "Action.Submit", "title": "Submit" }] }

On the top you will get a preview as below:

Image description
If you want to change the format you can do it here.

  • Copy the same script and paste it in the Adaptive card designer node in Microsoft Copilot Studio and select Save.

Image description

  • Refresh your Test your agent pane, you can see the form now appear along with the agent message.

Image description

  • At the Output section you can see five variables has been created.

Image description

  • Select each variable and make it as Global and then Save.

Image description

** All the variables are global now.

Image description

  • Select Add node, then select Call an action and then select Create a flow.

Image description

You will be redirected to Power Automate page.

  • Select Run a flow from copilot, then select +Add Input.

Image description

  • Add four inputs for our four variables.

Image description

These are the four variables we have in the Adaptive card script.

  • Add an action after the Run a flow from copilot step.

  • Select Send an email(v2) from the Add an action screen.

Image description

  • On the To section provide an email address to whom you to sent the feedback. Subject you can enter Feedback Result. Then on the Body enter the following: Following are the feedback recieved.

Name of the customer : @{triggerBody()?['text']}
Email : @{triggerBody()?['text_1']}
Feedback : @{triggerBody()?['text_3']}
Comments : @{triggerBody()?['text_2']}
Thanks !!!

Please note the triggerBody section you can dynamically select. After entered all the details, it looks as below:

Image description

  • Change the flow name and select publish.

Image description

  • After publishing the flow, go back to Copilot Studio and select Done. Then select Feedback flow from Call an action.

Image description

  • At the action section provide the values of all four power automate inputs. For example:

Image description

After giving values the action section looks like below:

Image description

  • Add another node for Send a message. Then provide the below message and save it:

You have successfully submitted your feedback. One of our team member will shortly contact you.
Thank you

  • Publish your Feedback Service Agent by clicking on Publish button from the top.
  • Refresh the Testing pane and start testing your agent by entering the details in feedback form.

Image description

  • Then select Submit.

If its asking for permission required, please select Connect. On the Manage your connections select Connect. On Create/Pick connections screen please select submit, once status became connected, please go to Copilot studio again and select Retry.

  • Now you can see the successful message as below:

Image description

  • You will receive an email as well.

Image description

Successfully completed a small example of creating a custom Copilot by using Microsoft Copilot studio with Adaptive card and Powerautomate.

Hope you enjoy the session.

Thank you for reading

Please leave a comment below if you have any further questions.

Happy Sharing !!!
Keep Learning | Spread Knowledge | Stay blessed |

Top comments (1)

Collapse
 
kaliyan profile image
Kaaliyaan

Very usefull