web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / copilot studio - previ...
Copilot Studio
Unanswered

copilot studio - previous 3 chat history - Question and Answer

(2) ShareShare
ReportReport
Posted on by 2
Hi Experts,
 
I am trying to get the previous conversation history in my copilot studio chat bot.
Any idea how to get that ? basically the previous 3 user question and its answer.
 
I want to pass/append this to the OpenAI call
 
I can see the below variables which has the Id.
 
Conversation.Id ----------11bcea57-4790-4bf3-xxxx-963371515f4c
Conversation
     {
    “Id”:“11bcea57-4790-4bf3-xxxx-963371515f4c”,
         “InTestMode”:true,“LocalTimeZone”:“America/New_York”,
         “LocalTimeZoneOffset”:{“$kind”:“TimeDataValue”,“value”:“-04:00:00”},
         “OnlyAllowDTMF”:false,“SipUuiHeaderValue”:null
    }


I can see the same reference in application-insights logs.

How can I achieve this feature,


Categories:
I have the same question (0)
  • Suggested answer
    Mahesh Chintha Profile Picture
    158 on at
    copilot studio - previous 3 chat history - Question and Answer
    You should be able to get the conversation history using the DirectLine API by passing the conversation ID and token. Follow this thread:
     
     

    Watch this video on implementing the similar solution.

    https://www.youtube.com/watch?v=DSzhaJS6564

    Please Accept as Solution if my reply answered your question. This will help others find solutions to similar questions. If you like my post and find it helpful, please consider giving it a Thumbs Up.


     
  • Anilal Gopinathan Profile Picture
    2 on at
    copilot studio - previous 3 chat history - Question and Answer
    @Mahesh,
     
    In that video, they are trying to get the Bearer token, I tried the same Fx snippet, but for me , it is returning a NULL

    I am using MS Copilot studio,  there i need to get the previous 3 User question and the Answer , and need to pass it to the Open-API custom call which I am making.

    Text(System.Activity.Value)  --  Null or empty


  • Suggested answer
    Mahesh Chintha Profile Picture
    158 on at
    copilot studio - previous 3 chat history - Question and Answer
    Try below to get the token and pass it to the conversation API.
     
     
    Please Accept as Solution if my reply answered your question. This will help others find solutions to similar questions. If you like my post and find it helpful, please consider giving it a Thumbs Up.
  • Anilal Gopinathan Profile Picture
    2 on at
    copilot studio - previous 3 chat history - Question and Answer
    used the below API to get the token

     
     
     
     
    Passed the above received token to the below end point, getting the error as below

    python  .\directLineAPI.py
    Failed to send activity. Status code: 403
    Response: {
      "error": {
        "code": "BadArgument",
        "message": "Token not valid for this conversation"
      }
    }
     
     
     
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 265 Super User 2025 Season 2

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 257 Super User 2025 Season 2

#3
Sam_Fawzi Profile Picture

Sam_Fawzi 84 Super User 2025 Season 2

Last 30 days Overall leaderboard