Can you filter then parse data from dynamic content in Power Automate?

I have a power automate flow that uses Get Email V3 and then uses that content to create an adaptive card.

The problem is that adding the 'Body' dynamic content from Get Email V3 into an adaptive card seems impossible. This results in an error being thrown saying that the json is invalid at the line that the dynamic content is added.

Instead of adding the full body I actually only want to fetch the first few words of the body anyway, so pulling that info out of the body may be the way to go. The email bodies always start with a name which is the only thing I need.

So as an example the body email would say, "Bruce Wayne just ..." the word 'just' is always there but the name will change, can I use power automate to grab the name at the beginning of each email body and parse that into a string from the dynamic body content?

{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
    {
        "type": "TextBlock",
         "text": "A new generic notification",
        "id": "Title",
        "spacing": "Medium",
        "horizontalAlignment": "Center",
        "size": "ExtraLarge",
        "weight": "Bolder",
        "color": "Accent"
    },
    {
        "type": "TextBlock",
        "text": "Received at @{body('Convert_time_zone')}",
        "id": "acHeaderTagLine",
        "separator": true
    },
    {
        "type": "TextBlock",
        "weight": "Bolder",
        "size": "Large",
        "spacing": "None",
        "id": "acHeader",
        "text": "Information Below"
    },
    {
        "type": "TextBlock",
        "text": "@{triggerOutputs()?['body/body']}",
        "id": "acDetails",
        "wrap": false
    },
    {
        "type": "TextBlock",
        "text": "Is this task complete?",
        "id": "acQuestion",
        "weight": "Bolder"
    },
    {
        "type": "ActionSet",
        "actions": [
            {
                "type": "Action.Submit",
                "id": "butSubmit",
                "title": "Yes, the generic thing was handled."
            }
        ]
    }
]

}



Read more here: https://stackoverflow.com/questions/68462709/can-you-filter-then-parse-data-from-dynamic-content-in-power-automate

Content Attribution

This content was originally published by Lycius at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: