I’m encountering an issue where the incoming webhook for Microsoft Teams seems to be down, and I’m trying to integrate it with a workflow to post to a channel. Here’s the situation in detail:
Context: I am using Power Automate to send notifications to a Microsoft Teams channel via an incoming webhook. The Logic App workflow receives a trigger, processes some data, and then posts a message to the Teams channel.
Problem: The webhook is not working as expected. When the Logic App reaches the step to post to Teams, I receive the following error:
Action 'Send_each_adaptive_card' failed: The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@triggerOutputs()?['body']?['attachments']' is of type 'Null'. The result must be a valid array.
The workflow includes a foreach loop to iterate over the attachments array in the trigger body.
GUI Workflow
However, it appears that the attachments property is either missing or not an array. The actual body of the post request looks like this:
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "DEFF22",
"summary": "kubewatch notification received",
"title": "kubewatch",
"sections": [
{
"activityTitle": "A `Event` in namespace `kube-system` has been `Updated`:n`snapshot-controller-leader.17e2f11cc47191c8`",
"facts": null,
"markdown": true
}
]
}
Attempted Solution: I tried to modify the foreach expression to iterate over the sections array instead of attachments as follows (view only):
{
"type": "Foreach",
"foreach": "@triggerOutputs()?['body']?['sections']",
"actions": {
"Post_card_in_a_chat_or_channel": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"poster": "Flow bot",
"location": "Channel",
"body/recipient/groupId": "sensitiveInfo",
"body/recipient/channelId": "sensitiveInfo",
"body/messageBody": "@item()?['activityTitle']"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_teams",
"connection": "shared_teams",
"operationId": "PostCardToConversation"
}
},
"metadata": {
"operationMetadataId": "cb658edd-383d-4e4a-b19e-198a01561be4"
}
}
},
"runAfter": {},
"metadata": {
"operationMetadataId": "34a88106-7324-436e-b6fb-2327f9b39b30"
}
}
Note: It’s a fact that I can’t edit it in Power Automate using code but can using the GUI. And, I can’t find the options I specified in the code using the Power Automate GUI; the options appear to be missing. I am still facing issues and would appreciate any help identifying what might be going wrong or suggestions for alternative approaches to make the webhook work with the workflow.
Thank you in advance for your help!
1