Reputation: 192
How to use adaptive cards for unfurling ?
I am able to send heroCard or thumbnailCard. Now trying something like this, but it doesn't work for me.
handleTeamsAppBasedLinkQuery(context: TurnContext, query: AppBasedLinkQuery) {
const attachment = CardFactory.adaptiveCard({
"type": "AdaptiveCard",
"body": [...],
"actions": [...],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2"
});
const result = {
attachmentLayout: 'list',
type: 'result',
attachments: [attachment]
};
return {
composeExtension: result
};
}
Documentation says it is possible: https://learn.microsoft.com/en-us/microsoftteams/platform/messaging-extensions/how-to/link-unfurling?tabs=javascript
Upvotes: 0
Views: 816
Reputation: 1
not really a solution as it just shows the hero card and not the adaptive card. Showing the adaptive card in the link unfurling chat window appears not to work.
Upvotes: 0
Reputation: 192
I found a solution! If you want to use Adaptive cards, they should have a preview.
So instead of:
const attachment = CardFactory.adaptiveCard(...)
You can write something like this and it works perfect:
const attachment = {
...CardFactory.adaptiveCard(...),
preview: CardFactory.heroCard(..., ...)
}
Upvotes: 2