Search code examples
node.jsbotframeworkadaptive-cards

Open new adaptive card with an adaptive card nodeJs


I'm trying to make use of the adaptive cards in bot framework. I was wondering if i could call a new adaptive card in the conversation using a button in another adaptive card? So not an inline adaptive card, but a NEW adaptive card in the conversation.

How is this possible, maybe some example code? I can't seem to find a solution?

Many thanks!


Solution

  • There is an Adaptive Card node sample here, that might be helpful: https://github.com/Microsoft/BotBuilder-Samples/blob/master/Node/cards-AdaptiveCards/app.js

    The Hotel Search card uses an action of type Action.Submit and demonstrates one method of how to respond with an adaptive card when a button is clicked:

    'actions': [
        {
            'type': 'Action.Submit',
            'title': 'Search',
            'speak': '<s>Search</s>',
            'data': {
                'type': 'hotelSearch'
            }
        }
    ]
    

    With code to respond here: https://github.com/Microsoft/BotBuilder-Samples/blob/master/Node/cards-AdaptiveCards/app.js#L177

    And the response: https://github.com/Microsoft/BotBuilder-Samples/blob/master/Node/cards-AdaptiveCards/hotels-search.js