I'm trying to use AdaptiveCards npm package on NodeJS to generate programmatically the card and I don't see how to generate the JSON to pass to the message. So far, my code is fairly simple:
session.send(new builder.Message(session).addAttachment({
contentType: "application/vnd.microsoft.card.adaptive",
content: createCard()
}));
function createCard() {
let card = new adaptiveCards.AdaptiveCard({ type: "AdaptiveCard" });
// add a text block
card.addItem(new adaptiveCards.TextBlock({
text: 'Issue #1',
weight: "bolder",
size: "medium"
}));
return card;
}
I've tried to call to render
method but it wasn't work. I also tried to call JSON.stringify(card)
but I get TypeError: Converting circular structure to JSON
message error.
Any idea? If I pass the JSON to the content attachment, all work fine.