Unfurlink Link (Adaptive card) in

Copper Contributor

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?

2 Replies

@Kzawadka 

 

@Tomasz Poszytek is like the master of adaptive cards in Microsoft Teams. Hopefully he will be able to help or know someone who can in this one. 

 

Whilst it states here that adaptive cards are supported with Link unfurling

 

Link unfurling - Teams | Microsoft Docs

 

He may be able to explicitly give you some pointers as to how to execute this one

 

Best, Chris 

@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
 }