How to send Adaptive Card with inline data to Teams via Webhook?

Ganesh Rao 6 Reputation points
2022-09-15T16:27:20.687+00:00

I have created a webhook url in Teams. I'm trying to send an adaptive card that I designed using adaptivecards.io/designer

My request looks like this:

curl -X POST "$webhookUrl" -H "Content-Type: application/json" -d "@card.json"  

contents of "card.json" look like this:

{  
  "type": "message",  
  "summary": "test inline data",  
  "attachments": [  
    {  
      "contentType": "application/vnd.microsoft.card.adaptive",  
      "contentUrl": null,  
      "content": {  
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",  
        "version": "1.3",  
        "type": "AdaptiveCard",  
        "$data": {  
          "message": "Hello world"  
        },  
        "body": [  
          {  
            "type": "TextBlock",  
            "text": "${message}"  
          }  
        ]  
      }  
    }  
  ]  
}  

"card.json" renders as expected in the adaptivecards.io/designer:
241592-screen-shot-2022-09-15-at-94847-am.png

However when I send this to the webhook, the card is not rendered correctly on Teams. It instead I only shows the template message which looks like this:

241469-screen-shot-2022-09-15-at-94943-am.png

I'd like to be able to send the $data inline instead of sending a rendered card (using SDKs such as "adaptivecards-templating") to the webhook. This is because sometimes the rendered content can result in a large string and can cause 413 errors. I'd like to avoid that.

Is it possible to send $data inline to webhooks? The documentation at https://learn.microsoft.com/en-us/adaptive-cards/templating/language makes it seem like this should be possible. Why isn't my example working as expected?

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,822 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Ahmed Abdullah 1 Reputation point
    2022-09-26T14:49:07.997+00:00

    We have same issue and are very interested in resolution to this. We have an application where we want to provide a connector to teams where user can specify destination webhook to teams and we want to use specific card formats/templating to take the data that's relevant to the message and post it to teams.

    0 comments No comments

  2. Meghana-MSFT 3,771 Reputation points Microsoft Vendor
    2022-12-19T14:36:22.26+00:00

    My apologies for the delayed response. Engineering team has confirmed that this scenario is currently not supported. Can you please help suggesting this feature on https://feedbackportal.microsoft.com/feedback/forum/ad198462-1c1c-ec11-b6e7-0022481f8472.

    0 comments No comments