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 / How to dynamically con...
Copilot Studio
Unanswered

How to dynamically construct the json payload correctly and send send it with HTTP Request

(0) ShareShare
ReportReport
Posted on by 26

I want to construct a json object in my Copilot chat bot (former PVA) with the following structure:

 

 

{

 "messages": [
 {
 "role": "bot",
 "content": "message1"
 },
 {
 "role": "user",
 "content": "message2"
 }
 ]
}

 

The tricky part is that I want the strings message1 and message2 to be read from variables.

 

I tried to create a string and then parse it to json with a schema, but I had no luck with that.

 

I'll appreciate any suggestions and recommendations. 

Thanks in advance

Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @Gosh ,

     

    I've made a test for your reference:

    1\Add a 'Parse value' and set data type to 'From sample data'

    vbofengmsft_0-1712567966641.png

    2\Get schema form sample JSON

    vbofengmsft_1-1712567995942.png

    vbofengmsft_2-1712568021346.png

    Result

    vbofengmsft_4-1712568195825.png

     

    3\Get first message

    First(Topic.Var1.messages).content

    vbofengmsft_3-1712568073274.png

    4\Get last message

    Last(Topic.Var1.messages).content

     

    Best Regards,

    Bof

  • Gosh Profile Picture
    26 on at

    Hi, Thank you for the response, but the problem I want to solve is vice versa. I need to get the value from a variable and apply it on the json object. 
    best regards

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 255 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

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

#3
S-Venkadesh Profile Picture

S-Venkadesh 101 Moderator

Last 30 days Overall leaderboard