Search code examples
node.jsbotframeworkadaptive-cards

Need a sample code for creating adaptive cards using node.js on emulator


Hi can anyone help me to create adaptive cards on bot framework emulator using node.js?? and I tried the example on https://learn.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-send-rich-cards on emulator but it is not creating the adaptive card.


Solution

  • The AdaptiveCard is just a JSON that you can send as an attachment of your message.

     session.send(new builder.Message(session).addAttachment({
         contentType: "application/vnd.microsoft.card.adaptive",
         content: // here you should put your json.
     }));
    

    Examples of adaptive cards JSONs can be found on the AdaptiveCards.io site, for example here.

    In the link you are mentioning, there is also a sample.