Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - General
Answered

Formatting response from Power Automate in virtual agent

(0) ShareShare
ReportReport
Posted on by 248

Hi does anyone know how to format a response returned to the virtual agent?

 

In Flow I have JSON output that is parsed and I use the "value" from the parse JSON action in the virtual agent response action, however the format is one long JSON string.

[{“id”:“234sodoz-48ff-4ee9-werwe-1edwerewb8dd”,“Name”:“TestName”,“DateTime”:“2018-11-29T23:34:24Z”,“manufacturer”:“Microsoft Corporation”,“model”:“Virtual Machine”,“serialNumber”:“90294”,“operatingSystem”:“Windows”}]

 

I'd like the output for the response to be in a readable format and accommodate for multiple records.  Anyone have ideas?  Ideally I'd like a table, however create CSV and HTML actions in Power Automate don't show correctly in the response either.

 

Categories:
  • Verified answer
    cbernier12 Profile Picture
    248 on at
    Re: Formatting response from Power Automate in virtual agent

    Ok, after some testing I figured out how to make a table format.  In the append to string variable stack the values on top of one another, then add a space on top and bottom between each value.  At the very top add some dashes and do the same for the very bottom underneath the last value.  Works really well.

     

    So it will look like this:

     

    ----------------------------------------------

    name

     

    id

     

    model

     

    etc...

    ----------------------------------------------------

     

    If you want you can add the title for each row next to the value if needed.

     

    So Name: namevalue and so on.

     

    @renatoromao @Pstork1 

     

  • cbernier12 Profile Picture
    248 on at
    Re: Formatting response from Power Automate in virtual agent

    @renatoromao I got it to work, so the output is still one big string only now the headers start and every entry has a | between it.  Pretty much back to where I started.  Is there no way to modify so it shows up in a table like format in the virtual agent?  Returning one record isn't an issue, however when there are multiple records, the response is a mess to read as it's just one long string of data in the UI.

  • cbernier12 Profile Picture
    248 on at
    Re: Formatting response from Power Automate in virtual agent

    Hi @renatoromao, yes very familiar with parsing HTTP calls with the parse JSON action, however it needs to be converted to an array not an object which is the default.  I can use select action, however it won't break out the individual values parse JSON does.

  • CU22081450-0 Profile Picture
    Most Valuable Professional on at
    Re: Formatting response from Power Automate in virtual agent

    HI @cbernier12 ,

     

    If you are using Http request to get data from other API or something like that, you need to confirm which is the return that you are receiving because I used your sample to build this template.

     

    Basically you will use the HTTP body inside the Content field on the Parse JSON action and maintain the same parse that I used. (Maybe you can remove the required property, but it’s not necessary yet before work the read content values).

     

    Can you send a screenshot about your http result?

    And also send the result here (you can remove sensitivity information)

  • cbernier12 Profile Picture
    248 on at
    Re: Formatting response from Power Automate in virtual agent

    Actually I'm using a HTTP call that pulls data back and then I parse it with a parse JSON action, in the apply to each action I need to somehow convert the object to an array I guess.  Or will that not work either?

     

    ExpressionEvaluationFailed. The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON')' is of type 'Object'. The result must be a valid array.

  • cbernier12 Profile Picture
    248 on at
    Re: Formatting response from Power Automate in virtual agent

    @renatoromao I tried your example exactly and I receive the following at the parse JSON action:

     

    The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value cannot be parsed: 'Invalid property identifier character: “. Path '[0]', line 1, position 2.'.

  • Pstork1 Profile Picture
    66,477 Most Valuable Professional on at
    Re: Formatting response from Power Automate in virtual agent

    I suspect you are looking for the ability to return an array to PVA the way you can with Power Apps.  That functionality isn't currently available.  As @renatoromao said you need to format your response as text in the Flow and then return it to PVA for display.  You can't return a raw array the way you can when using an HTTP Response to return JSON to Power Apps.  It may be possible in the future, but isn't at this point.

  • CU22081450-0 Profile Picture
    Most Valuable Professional on at
    Re: Formatting response from Power Automate in virtual agent

    Hi @cbernier12 ,

     

    I posted all steps above.

    You can follow it and if you need to use the PArse Json Schema, you can see my code below:

     

    {
        "type""array",
        "items": {
            "type""object",
            "properties": {
                "id": {
                    "type""string"
                },
                "Name": {
                    "type""string"
                },
                "DateTime": {
                    "type""string"
                },
                "manufacturer": {
                    "type""string"
                },
                "model": {
                    "type""string"
                },
                "serialNumber": {
                    "type""string"
                },
                "operatingSystem": {
                    "type""string"
                }
            },
            "required": [
                "id",
                "Name",
                "DateTime",
                "manufacturer",
                "model",
                "serialNumber",
                "operatingSystem"
            ]
        }
    }
  • CU22081450-0 Profile Picture
    Most Valuable Professional on at
    Re: Formatting response from Power Automate in virtual agent

    1.png

     

    2.png

     

    3-.png

  • CU22081450-0 Profile Picture
    Most Valuable Professional on at
    Re: Formatting response from Power Automate in virtual agent

    Hi @cbernier12 ,

     

    You can use Markdown to format results inside the Power Virtual Aggents.

     

    Basically, you need to create a parse JSON action inside the Power Automate, read all properties and format the results inside your workflow.

    After that, you need to create a response to your chatbot using a string property.

     

    I will create a sample, wait some minutes, please.

    But you can read this documentation: Use markdown to format Power Automate approvals - Power Automate | Microsoft Docs

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Copilot Studio - General

#1
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 76

#2
Pablo Roldan Profile Picture

Pablo Roldan 61

#3
stampcoin Profile Picture

stampcoin 10

Overall leaderboard