cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
juroy_lim
New Member

What is the best way to save the conversation log and the associated user details such as email, user ID, and timestamp for each chat?

I am developing a simple chatbot using Microsoft Copilot Studio and have deployed it in Teams. I am currently exploring how to store the entire chat history, along with user metadata such as email, user ID, and timestamp for each chat. 

I also wonder if there is a place that we can access to these data?

4 REPLIES 4
Israel_Ramakuri
Frequent Visitor

Hi Juroy,

We had a similar requirement to push the chat history to teams channel if it hits escalation.

By default if the bot is pinned to teams, the individuals will be able to see their chat history.

But i am assuming that you want to see the entire chat history for all users.

We have a table inside Dataverse called 'ConversationTranscripts' which stores all the chat history. You can see the same by looking at Content field in that table. This information is kind of formatted. We need to apply some logic to make the text look simple.

You can use powerautomate dataverse connector to retrieve this information. Ofcourse this is a premium connector. 

As far as the user information is concerned, this information is available inside the bot as system variables and if required you should be able to store this information by triggering a powerautomate inside your topic and storing it in someplace like sharepoint list or can also publish this information to teams channel etc.

 

This whole approach works for Copilot Studio only and not for Copilot Studio for Teams. If you have a bot created using Copilot Studio then you are good.

 

Regards

Karun

 

Murali2
New Member

I'm using copilot studio with user login.

I would like to do the same. Retrieving conversation logs/chat history only for the logged in user.

Could you please share the scripts or a demo video on this.

Do you mind writing a tutorial blog or recording a tutorial video on how you implement it?

Israel_Ramakuri
Frequent Visitor

Initial Approach:

When we started looking for options, we could initially figure out that this information is stored in the Dataverse table called Conversation Transcripts. Each interaction is created as a record and the entire conversation is stored in a field called Content field. The idea is to use Power Automate in the Escalate Topic to retrieve this record from the Conversation Transcripts table using the Conversation ID and post the chat conversation in the Teams Channel, in case of an escalation.

 

Israel_Ramakuri_0-1713770795302.png

Figure 1: Dataverse Tables accessible after navigating to Power Apps or Power Automate

 

Israel_Ramakuri_1-1713770795309.png

Figure 2: Conversation Transcript (Stores Chat Conversations) Table in the Dataverse

 

Israel_Ramakuri_2-1713770795313.png

Figure 3: Content field that stores the chat conversation

 

Israel_Ramakuri_3-1713770795333.png

Figure 4: Raw data in the Content Field. Additional formatting to be done to extract the required information.

 

Inferences based on the initial approach:

  • Significant delay in the record creation after the conversation ended. Record is not created for close to 30 mins.
  • Use of Premium Connector for Dataverse in Power Automate to query the Conversation Transcripts Table adds additional cost.

The above points made us look for an alternative approach. We looked at Global Variables and we could successfully append the data to the global variable using Power Fx Formulas.

Our Approach:

The approach was based on Global Variables creation and appending the same across all the topics.

Below are high level steps as part of this approach.

  1. Adding/Declaring Global Variable in Conversation Start Topic.
  2. Appending the Global Variable with both the question and the user response in all the topics.
  3. Use Global Variable within the Escalation Topic and trigger a PowerAutomate within the topic by passing this variable for the chat conversation to be posted to Teams Channel.

Benefits from this approach

  1. Chat Conversation is available immediately in the Teams Channel in case of escalation.
  2. Don’t need any premium connectors to access the Dataverse Conversation Transcripts Table.

Customizing Existing Inbuilt Topics

  1. Conversation Start Topic:

This topic is triggered at the start of the conversation. Declared global variables in this Topic as below.

  • BotName: Stores the name of the Chatbot.
  • UserName: Stores the display name of the user interacting with the Chatbot.
  • Mainvar: Stores details of the chat history.
  • BreakLine: Used for new line in the PVA and Teams Chat (Post in Teams Channel).

Israel_Ramakuri_4-1713770795337.png

Figure 5: Global Variables declared in Conversation Start Topic

 

  1. Fallback Topic:

This topic is triggered when the Chatbot cannot match the user's question or message to a trigger phrase. It will prompt the user with the message:

I'm sorry, I'm not sure how to help with that. Can you try rephrasing?

If the user's question remains unanswered, it hits the Escalate Topic, where the user receives a customized the message:

I'm sorry, I couldn't help you with your query. However, I've forwarded your query to the IT Service Team. They will get in touch with you shortly.

Israel_Ramakuri_5-1713770795350.png

Figure 6: Appending data to Global Variable.

 

  1. Escalation Topic:

This topic is triggered when the bot is not able to answer the user query.

Israel_Ramakuri_6-1713770795355.png

Figure 7: Input variables to Power Automate are passed here so the chat conversation is posted in Teams Channel

 

Israel_Ramakuri_7-1713770795358.png

Figure 8: Power Automate to post the chat history to Teams Channel and to create a log in sharepoint list

Log entire chat history in sample topic:

  • Create a topic IT Help desk.
  • Set the global variable value at every node as below.

 

Israel_Ramakuri_8-1713770795367.png

Figure 9: Sample Topic depicting the Global Variable Append operation.

 

Israel_Ramakuri_9-1713770795374.png

Figure 10: Appending Name Question and User Response to Global Variable

 

Israel_Ramakuri_10-1713770795381.png

Figure 11: Appending Age Question and User Response to Global Variable

 

Israel_Ramakuri_11-1713770795391.png

Figure 12: Appending DOB Question and User Response to Global Variable

 

Israel_Ramakuri_12-1713770795400.png

Figure 13: Sample Output of Chat Conversation posted to Teams Channel using PowerAutomate

 

Note:

  • Global Variables used in the approach mentioned above has an overhead of updating the same in the new topics that will be created and if any updates are made to existing topics. This approach worked for us since the client requested us to capture only the last user query to which the bot couldn’t respond.
  • The above approaches work only with Copilot Studio for Web and not in Copilot Studio for Teams.

Israel_Ramakuri_13-1713770795407.png

Figure 14: Copilot Studio for Teams based Bot Actions

 

Copilot Studio for Teams has few limitations.

  • It doesn't support the declaration of global variables.
  • Data is not available for query within the Dataverse Conversation Transcripts table.

Helpful resources

Announcements

Exciting News for Copilot Studio Community! 🌟

Get ready to experience a whole new level of engagement with the Copilot Studio Community beginning this June! We’re thrilled to announce significant enhancements to our Community Blogs and Forums, designed to foster collaboration, creativity, and connection in the Community. 🚀💡   What’s New? 🌟 Revamped Community Blogs: Dive into a more intuitive and enriched blogging experience, where sharing knowledge and insights is easier and more enjoyable than ever. Enhanced Forums: Engage in discussions, ask questions, and connect with peers through our improved forums, now with better navigation and user-friendly features.  Why Check It Out? ✔ Stay Informed: Keep up with the latest trends, tips, and tricks from Copilot experts and fellow community members.Expand Your Network: Connect with like-minded professionals and build lasting relationships within the community.Share Your Voice: Contribute your own stories, solutions, and successes to inspire and educate others.   Stay tuned for more details as we approach the launch date. We can’t wait for you to join us in this new chapter of the Copilot Studio Community. Together, let’s make it a hub of innovation and inspiration!   

Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   😊Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!      

Welcome to the Copilot Studio Community!

You are now a part of a vibrant growing group of peers and industry experts who are here to network, share knowledge, and even have a little fun!   If you have not yet registered, please visit here to learn how to register!   Now that you are a member, you can enjoy the following resources:   The Microsoft Copilot Studio Community Forums If you are looking for support with any part of Microsoft Copilot Studio, our forums are the place to go. They are titled "Forums" and there you will find technical professionals with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Copilot Studio Community forums! Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered!   Microsoft Copilot Studio Ideas Do you have an idea to improve the Microsoft Copilot Studio experience, or a feature request for future product updates? Then the "Copilot Studio Ideas" section is where you can contribute your suggestions and vote for ideas posted by other Community members. We constantly look to the most voted Ideas when planning updates, so your suggestions and votes will always make a difference.   News & Announcements The Copilot Studio Community News & Announcements is your stop to get all the latest news around Community events and announcements. This is where we share with the Community what is going on and how to participate!   Copilot Studio Samples, Learning and Video Galleries We have galleries that can assist you with information on creating a bot in our Webinars and Video Gallery,  and the ability to share the bots you have created in our Bot Sharing Gallery.  Check out the awesome content being shared there today!   Again, we are excited to welcome you to the Microsoft Copilot Studio Community family! Whether you are brand new to the world of bot creation or you are a seasoned Copilot Studio veteran, our goal is to shape the Community to be your ‘go to’ for support, networking, education, inspiration and encouragement as we enjoy this adventure together!   Let us know in the Community Feedback if you have any questions or comments about your Community experience. To learn more about the Community and your account be sure to visit our Community Support Area boards to learn more!   We look forward to seeing you in the Copilot Studio Community!The Copilot Studio Community Team

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Top Solution Authors
Users online (4,828)