Search code examples
botframeworkadaptive-cards

Create custom element for AdaptiveCard for Bot Task Module


I'm developing a MS.Teams bot using BotFramework in NodeJS and use Task Module capability to dynamically generate a layout for the adaptive cards. But there's a need in my layout to have an autocomplete text box, which makes an API call when user types in the textbox and show an autocomplete selection.

I have read this documentation here, but it's not clear on how to apply it for the bot API?

I wonder if anyone ever builds a custom element for AdaptiveCards that has interactive experience in it? Or is it even possible to do so?


Solution

  • The Adaptive Cards JavaScript SDK will only be available to you if you're coding in JavaScript. You linked to a document in the section about rendering cards, and if you're sending a card to Teams then you don't get to do any rendering. Teams is in charge of rendering its cards, not you.

    What this means is that you won't have access to any Adaptive Cards extensibility features. If you want to send an Adaptive Cards to an app like Teams, you will only have access to the Adaptive Cards functionality that Teams supports, and that will mostly just include the out-of-the-box Adaptive Cards features.

    As a workaround, you can try using an iframe task module instead of an Adaptive Card task module. You could render an extended Adaptive Card on your web page or you could build your own UI that doesn't rely on Adaptive Cards at all.