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

Notifications

Announcements

Community site session details

Community site session details

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

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
    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
    @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
    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
    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
Michael E. Gernaey Profile Picture

Michael E. Gernaey 261 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

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

#3
S-Venkadesh Profile Picture

S-Venkadesh 93 Moderator

Last 30 days Overall leaderboard