microsoft-teamspower-automateadaptive-cards

Power Automate: Teams Workflow Not Working


So, it is my understanding that with the new Workflows app in Teams, I should be able to post a standard "webhook" that worked with Microsoft 365 connectors to a target webhook URL and then it will process that data and post it to a Teams channel.

Workflow looks like this:

workflow

HOWEVER, when we post content like this to the workflow:

{
  "attachments": [
    {
      "type": "AdaptiveCard",
      "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
      "version": "1.5",
      "body": [
        {
          "type": "Container",
          "items": [
            {
              "type": "TextBlock",
              "text": "New TextBlock",
              "wrap": true,
              "weight": "Bolder",
              "size": "Large"
            }
          ]
        },
        {
          "type": "ColumnSet",
          "columns": [
            {
              "type": "Column",
              "width": "stretch",
              "items": [
                {
                  "type": "TextBlock",
                  "text": "Col 1, Row 1:",
                  "wrap": true,
                  "weight": "Bolder"
                },
                {
                  "type": "TextBlock",
                  "text": "Co 2, Row 2:",
                  "wrap": true,
                  "weight": "Bolder"
                }
              ]
            },
            {
              "type": "Column",
              "width": "stretch",
              "items": [
                {
                  "type": "TextBlock",
                  "text": "Col 2, Row 1",
                  "wrap": true
                },
                {
                  "type": "TextBlock",
                  "text": "Col 2, Row 2",
                  "wrap": true
                }
                      ]
                  }
              ]
          }
      ]
  }
  ],
  "type":  "message",
}

we get this error reply from the request end:

{
    "error": {
        "code": "TriggerInputSchemaMismatch",
        "message": "The input body for trigger 'manual' of type 'Request' did not match its schema definition. Error details: 'Required properties are missing from object: contentType, content.'."
    }
}

I'm confused as to where to move on this, because this doesn't seem to match any known documented format for using the Workflow app (Power Automate) in Teams to process messages.

So either Microsoft's documentation is not updated, or I'm doing something wrong.

Anyone got any idea what "schema" format I have to apply to the JSON to work properly with the Workflow/Automate app's workflows?


Solution

  • So, there are multiple issues at play.

    Firstly, Teams workflows in this way only support up to AdaptiveCards 1.3, evidenced by the current New Teams functions. Despite the documentation saying AdaptiveCards 1.5. Which means 1.5 cards do not render in a way the Teams desktop apps can use in all cases. Which means documentation in Microsoft's end is out of date (and I indicated to Prasad to yell at the Documentation teams to update this note.)

    Secondly, as Prasad-MSFT said in comments on my question, with the documentation here, this contained the proper format, in that "attachments" items each need their own contentType, contentUrl, and content sections. This differs from past webhooks which don't refer to this need. As such, Microsoft has to properly relink all documentation on this and make it actually functional.

    Taking all this into account, the adaptive card submit looks like this in the actual body content submitted:

    {
      "type": "message",
      "attachments": [
        {
          "contentType": "application/vnd.microsoft.card.adaptive",
          "contentUrl": null,
          "content": {
            "type": "AdaptiveCard",
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "version": "1.3",
            "body": [
              {
                "type": "TextBlock",
                "text": "Test Card",
                "wrap": true,
                "weight": "Bolder",
                "size": "Large"
              },
              {
                "type": "ColumnSet",
                "columns": [
                  {
                    "type": "Column",
                    "width": "stretch",
                    "items": [
                      {
                        "type": "TextBlock",
                        "text": "Col 1:",
                        "wrap": true,
                        "weight": "Bolder"
                      }
                    ]
                  },
                  {
                    "type": "Column",
                    "width": "stretch",
                    "items": [
                      {
                        "type": "TextBlock",
                        "text": "Col 2",
                        "wrap": true
                      }
                    ]
                  }
                ]
              }
            ]
          }
        }
      ]
    }