Adaptive Cards with Incoming Webhooks in Microsoft Teams

Anthony 16 Reputation points
2021-05-19T04:49:22.427+00:00

Hi There,
I have been working on trying to use Adaptive Cards (AC) with webhooks in Microsoft Teams.

According to this YouTube post https://www.youtube.com/watch?app=desktop&v=y5pbJI43Zvg from "Ojasvi Choudhary" Jun 26, 2020 they are now enabled with in Teams.
However if I take an example form https://adaptivecards.io and use postman to send the card as suggested in the video I get an error in Postman "Summary or Text is required."
If I use Postman to send the old Messagecards then everything appears to work. Note this means I have the teamId and channelid correct and the webhook setup correctly as I can actually post to the channel.

So I need a working example like seen in the youtube video but I suspect he is posting to a development endpoint as we never see it.

Is the video wrong?
Am I missing something with the samples?
Are Webhooks STILL not implemented to use AC's

Please let me know ASAP as I need to be able to mention a person in a post using Webhooks.

If you have any example of how to mention a person using Webhooks that would also be appreciated. (C# code even better)

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,892 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Mamatha-MSFT 156 Reputation points
    2021-05-19T14:41:20.36+00:00

    Hi @Anthony - Please follow the below json format for adaptive card in webhook.

    {  
       "type":"message",  
       "attachments":[  
          {  
             "contentType":"application/vnd.microsoft.card.adaptive",  
             "contentUrl":null,  
             "content":{  
                "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",  
                "type":"AdaptiveCard",  
                "version":"1.2",  
                "body":[  
                    {  
                    "type": "TextBlock",  
                    "text": "For Samples and Templates, see [https://adaptivecards.io/samples](https://adaptivecards.io/samples)"  
                    },  
                    {  
                        "type": "Image",  
          "url": "https://adaptivecards.io/content/cats/1.png"      
                    }  
                ]  
             }  
          }  
       ]  
    }  
    
    3 people found this answer helpful.
    0 comments No comments

  2. Anthony 16 Reputation points
    2021-05-20T07:23:33.707+00:00

    Yes thank you the Adaptive Card with the additional webhook requirements you posted works.

    Can you please provide an example that works with mention as this is what is stated in the video will work but I have had no success.

    As an FYI the reason the above sample works but the ones on https://adaptivecards.io/samples did not out of the box is the additional wrapping that is required

    {
    "type":"message",
    "attachments":[
    {
    "contentType":"application/vnd.microsoft.card.adaptive",
    "contentUrl":null,
    "content":

    The content section above can now be filled with the adaptive card samples from https://adaptivecards.io/samples

    That is what is stated at https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using

    • The "type" field must be "message".
    • The "attachments" array contains a set of card objects.
    • The "contentType" field must be set to adaptive card type.
    • The "content" object is the card formatted in JSON.

    But I missed the significance of that the first time around.

    If you could provide an example with mention in it that works that would be fantastic.

    3 people found this answer helpful.
    0 comments No comments

  3. Mamatha-MSFT 156 Reputation points
    2021-05-20T13:19:17.727+00:00

    Hi @Anthony The at mention for adaptive card will works only when you send the card from bot. You need to get the user id from turncontext.activity.from. Because the ms teams object will only work in bots not in incoming webhooks.

    Microsoft will always focus on customer’s feedback and experience, some new features would be added to the services based on customers' feedback in the future, we also recommend you give your new idea in Teams UserVoice here if this needs to be consider as a future request.

    1 person found this answer helpful.