We currently have 2 Webhook integrations that create cards in Teams channels. Considering Microsoft's extremely quick timeline to deprecate Webhook connectors, we were hoping to get some support in converting these as there doesn't seem to be much in terms of documentation available on this.
Webhook 1:
The first webhook sends the payload in the following format:
{
"@context": "https://schema.org/extensions",
"@type": "MessageCard",
"themeColor": "0072C6",
"title": "Title text....",
"text": "Body test...",
"potentialAction": []
}
And we are getting the following error with the default "Post to ... when a webhook request is received" flow:
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.
We have tried several changes within the workflow to correctly parse the MessageCard object and also read it in as an Array, but nothing has been successful.
Webhook 2:
The second webhook uses Python to send the payload as a ConnectorCard:
myTeamsMessage = pymsteams.connectorcard(teams_url)
myTeamsMessage.text(current_password)
myTeamsMessage.send()
This was very simple, as we are just passing a string as the message text. I was able to successfully convert this to be accepted by the flow. This was the resulting code:
myTeamsMessage = pymsteams.connectorcard(teams_url)
fullMessageJson = {
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": current_password
}
]
}
}
]
}
myTeamsMessage.payload = fullMessageJson
myTeamsMessage.send()
Since we were able to figure out the second webhook, Webhook 1 is really what we need some help on, since we cannot change the payload that is being sent from the ticketing API we rely on.
Is there a way to edit the flow so that it can accept the MessageCard type, or do we need to convert that to the array of AdaptiveCard types before sending the request to the workflow?