Forum Discussion
Error while running Teams workflow for sending message to a channel by triggering webhook
- Aug 29, 2024
@basharh190 , StoneE1085, sushantp1105 ,BrianA1775, MattJ1810, nidheeshbabu96, RCFTech
We tried to test this by creating a workflow and then by POSTing a payload to the webhook URL. The workflow sent the message successfully in desired team's channel.
Workflow:
Step:1Step:2
Step:3
Running cURL command:
Result:
Prasad_Das-MSFT How do i render the html content in a message card while posting to a channel using webhooks it's ignoring the html and treating it as plain text
psrujan , instead of using "Post message in a chat or channel", we used "Post card in a chat or channel " action by using below JSON and the card got posted successfully in card format.
Card JSON:
("When a Teams webhook request is received" trigger does not support actionable messages, unlike deprecated Office Webhooks.)
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"text": "Test Report",
"weight": "bolder",
"size": "large",
"wrap": true,
"color": "accent",
"horizontalAlignment": "center"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "TextBlock",
"text": "**Record:** Basics\n**TestCases:** PassOrFail",
"wrap": true
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "**Test Results:**\n\n**Passed:** <testsPassed>\n**Failed:** <testsFailed>\n**Total:** <totalTests>",
"wrap": true
}
]
}
]
},
{
"type": "FactSet",
"facts": [
{
"title": "Records:",
"value": "Basic"
},
{
"title": "TestCases:",
"value": "PassOrFail"
},
{
"title": "Passed:",
"value": "<testsPassed>"
},
{
"title": "Failed:",
"value": "<testsFailed>"
},
{
"title": "Total:",
"value": "<totalTests>"
}
]
}
]
}
}
]
}
Result: