Forum Discussion

Kzawadka's avatar
Kzawadka
Copper Contributor
Dec 29, 2020

Unfurlink Link (Adaptive card) in

Hello

We try to return an adaptive card to the Microsoft Teams message area after pasting a URL in the MS Teams message area as shown here (line 17). The only difference between our code and the code displayed here is that instead of returning a Hero Card we would like to return an adaptive card. Unfortunately for some reason the adaptive card is not displayed in the MS Teams message area after pasting the URL in the message area.

 Could you share the way how to do it the correct way?

  • PaulJereb's avatar
    PaulJereb
    Copper Contributor

    Kzawadka I found the following solution: apparently the attachment requires a preview defined when returning an Adaptive Card.

     

    Here a snipped how it works in Javascript:

     const adaptiveCard = CardFactory.adaptiveCard(card);
     const heroCard = CardFactory.heroCard("card title", "card text");
    
     const attachment = {
       contentType: adaptiveCard.contentType,
       content: adaptiveCard.content,
       preview: heroCard
     }

     

Resources