Send "type": "Table" as AdaptiveCard via MS Teams Incoming Webhook

Szewczyk, Dawid 36 Reputation points
2022-04-13T12:22:58.833+00:00

Hey,
I'm trying to share a table via Incoming Webhook Connector, similar to the table shown here: https://adaptivecards.io/explorer/Table.html
Ideally I would also use @mention in the same message as described here: https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-format?tabs=adaptive-md%2Cconnector-html#user-mention-in-incoming-webhook-with-adaptive-cards

I'm running into "webhook message delivery failed with error: Microsoft Teams endpoint returned HTTP error 400 with ContextId MS-CV=HnpK8NsUJ0qyTeXzd3RHoQ.0.." and/or"Summary or Text is required." while trying to add the table into the msg.
Can someone share a working example for Incoming Webhook Connector?

Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,968 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Szewczyk, Dawid 36 Reputation points
    2022-04-13T13:18:23.047+00:00
    {
        "type": "message",
        "attachments": [
            {
            "contentType": "application/vnd.microsoft.card.adaptive",
            "content": {
                "type": "AdaptiveCard",
                "body": [
                    {
                        "type": "TextBlock",
                        "size": "Medium",
                        "weight": "Bolder",
                        "text": "Health Check for Critical Workflows"
                    },
                    {
                        "type": "TextBlock",
                        "text": "<at>Developer</at>, Foo Blaa",
                        "color": "attention",
                        "wrap": true
                    },
                    {
                        "type": "Table",
                        "gridStyle": "accent",
                        "firstRowAsHeaders": true,
                        "columns": [
                            {
                                "width": 1
                            },
                            {
                                "width": 1
                            }
                        ],
                        "rows": [
                            {
                                "type": "TableRow",
                                "cells": [
                                    {
                                        "type": "TableCell",
                                        "items": [
                                            {
                                                "type": "TextBlock",
                                                "text": "Name",
                                                "wrap": true,
                                                "weight": "Bolder"
                                            }
                                        ]
                                    },
                                    {
                                        "type": "TableCell",
                                        "items": [
                                            {
                                                "type": "TextBlock",
                                                "text": "Type",
                                                "wrap": true,
                                                "weight": "Bolder"
                                            }
                                        ]
                                    }
                                ],
                                "style": "accent"
                            },
                            {
                                "type": "TableRow",
                                "cells": [
                                    {
                                        "type": "TableCell",
                                        "style": "good",
                                        "items": [
                                            {
                                                "type": "TextBlock",
                                                "text": "columns",
                                                "wrap": true
                                            }
                                        ]
                                    },
                                    {
                                        "type": "TableCell",
                                        "style": "warning",
                                        "items": [
                                            {
                                                "type": "TextBlock",
                                                "text": "ColumnDefinition[]",
                                                "wrap": true
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                "type": "TableRow",
                                "cells": [
                                    {
                                        "type": "TableCell",
                                        "style": "good",
                                        "items": [
                                            {
                                                "type": "TextBlock",
                                                "text": "rows",
                                                "wrap": true
                                            }
                                        ]
                                    },
                                    {
                                        "type": "TableCell",
                                        "style": "accent",
                                        "items": [
                                            {
                                                "type": "TextBlock",
                                                "text": "TableRow[]",
                                                "wrap": true
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ],
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                "version": "1.5",
                "msteams": {
                    "width": "full",
                    "entities": [
                        {
                            "type": "mention",
                            "text": "<at>Developer</at>",
                            "mentioned": {
                              "id": "some ID",
                              "name": "Developer"
                            }
                          }
                    ]
                }
            }
        }]
    }