Nela Kolundzija
Nela Kolundzija

Reputation: 1

How do i get body of get message details in teams connector inside azure logic app

photo of response

is it possible to grab attachments content which is sting value filled with json and I need to grab text value from it outputs('Get_message_details')?['body']['attachments'][0]?['content'] I can get whole sting json but do not know how inside of azure logic app grab this text from ['content'] thnx

last(split(variables('messagesummary'), '\n')) try with last and split function to parse messagesummary which containes ['content'] value

I need to grab this "Time SLA alert"

"body": {
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('-a1d4-')/channels('1read.skype')/messages/$entity",
    "id": "178",
    "replyToId": "1732848",
    "etag": "1732871025948",
    "messageType": "message",
    "createdDateTime": "2024-11-29T09:03:45.948Z",
    "lastModifiedDateTime": "2024-11-29T09:03:45.948Z",
    "lastEditedDateTime": null,
    "deletedDateTime": null,
    "subject": null,
    "summary": null,
    "chatId": null,
    "importance": "normal",
    "locale": "en-us",
    "webUrl": "https://teams.microsoft.com/l/message/19%3Acc47485597a7ae%40thread.skype/1tenantIbb6d-10f4&createdTime=173225948&parentMessageId=1732871025948",
    "policyViolation": null,
    "eventDetail": null,
    "from": {
        "device": null,
        "user": null,
        "application": {
            "@odata.type": "#microsoft.graph.teamworkApplicationIdentity",
            "id": "358f018a9ec87",
            "displayName": "Workflows",
            "applicationIdentityType": "bot"
        }
    },
    "body": {
        "contentType": "html",
        "content": "<attachment id=\"768f1fd\"></attachment>",
        "plainTextContent": ""
    },
    "channelIdentity": {
        "teamId": "5fe92",
        "channelId": "19:[email protected]"
    },
    "attachments": [
        {
            "id": "7685a1fd",
            "contentType": "application/vnd.microsoft.card.adaptive",
            "contentUrl": null,
            "content": "{\r\n  \"type\": \"AdaptiveCard\",\r\n  \"body\": [\r\n    {\r\n      \"color\": \"attention\",\r\n      \"size\": \"large\",\r\n      \"text\": \"\\n[FIRING] Time SLA alert\\n\",\r\n      \"weight\": \"bolder\",\r\n      \"wrap\": true,\r\n      \"type\": \"TextBlock\"\r\n    },\r\n    {\r\n      \"text\": \"\\nAnnotations:\\n - message = Time SLA in prod is below 97.5\\n\\nValue: B0=97.35300516227274\\n\\nGo to Dashboard: [https://xbns.azurewebsites.net/d/health-prod?orgId=1](https://xbbs.azurewebsites.net/d/health-prod?orgId=1)\\n\\nGo to Panel: [https://jkfjdalk.azurewebsites.net/d/health-prod?orgId=1&viewPanel=65](https://jdkljf.azurewebsites.net/d/health-prod?orgId=1&viewPanel=65)\\n\\n\",\r\n      \"wrap\": true,\r\n      \"type\": \"TextBlock\"\r\n    },\r\n    {\r\n      \"actions\": [\r\n        {\r\n          \"url\": \"https://kjfdlkafj.azurewebsites.net/alerting/list\",\r\n          \"title\": \"View URL\",\r\n          \"type\": \"Action.OpenUrl\"\r\n        }\r\n      ],\r\n      \"type\": \"ActionSet\"\r\n    },\r\n    {\r\n      \"items\": [\r\n        {\r\n          \"size\": \"small\",\r\n          \"text\": \"xyx Workflow template to send this card. [Get template](https://teams.microsoft.com/l/task/c3?url=https%3A%2F%2Fmake.powerautomate.com%2Fteams%2Fstore%2FflowCreatf)\",\r\n          \"weight\": \"lighter\",\r\n          \"wrap\": true,\r\n          \"type\": \"TextBlock\"\r\n        }\r\n      ],\r\n      \"separator\": true,\r\n      \"type\": \"Container\"\r\n    }\r\n  ],\r\n  \"version\": \"1.2\",\r\n  \"msTeams\": {\r\n    \"width\": \"full\"\r\n  }\r\n}",
            "name": null,
            "thumbnailUrl": null,
            "teamsAppId": null
        }
    ],

Upvotes: 0

Views: 131

Answers (1)

Ikhtesam Afrin
Ikhtesam Afrin

Reputation: 6497

You need to use the given flow after retrieving the whole Json string using outputs('Get_message_details')?['body']['attachments'][0]?['content'] expression.

Once you have fetched the Json string value then add Parse JSON action followed by compose action.

Parse Json action takes the value of Json string as an input.

enter image description here

Post this use outputs('Parse_JSON')?['body']?['body'][0]?['text'] expression in compose action to get the desired result.

enter image description here

Upvotes: 0

Related Questions