Tuesday 16 May 2017

AdaptiveCard: how to use in NodeJS

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. Any idea?



via sGambolati

No comments:

Post a Comment