question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Idea: Bot.Builder.Community.Cards

See original GitHub issue

I believe the only mention of Adaptive Cards in the Bot Builder SDK is in the Node SDK’s CardFactory. I don’t think there’s any mention of Adaptive Cards in the .NET SDK.

As a Bot Framework support engineer, I see many recurring tasks that people want Adaptive Cards to perform in their bots. While there is already an Adaptive Cards NuGet package that provides some helpful models that bots can use, I think it would be even more helpful if there was an Adaptive Cards package that contained bot-specific functionality.

@mdrichardson has already created an Adaptive Card prompt that we have talked about making into a Bot Builder Community package. Since then, I’ve given some thought into whether we should have AdaptiveCardPrompt as its own package or include it in a package among other Adaptive Card utilities. Here is a short list of tools that I think would work well in an Adaptive Cards package:

  1. Translate cards - example: 1
  2. Disable cards - examples: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
  3. Dynamically add or remove elements to already-posted Adaptive Cards (only on channels that support message updates) - examples: 1, 2
  4. Automatically generate a card based on a data structure, the way FormFlow generates a dialog based on the information that needs to be gathered

Disabling Adaptive Cards is already built into Michael’s Adaptive Card prompt, but it’s possible that people might also want that kind of functionality without using a prompt. I listed my Adaptive Card prompt ideas in Michael’s DCR, but I’ll reiterate a short list of points about what Adaptive Card prompts are supposed to do here:

  1. Only accept input from specific cards that are bound to the prompt
  2. Allow both customized and automatic field validation
  3. Provide feedback about faulty input

I plan to work on this myself, so I am not making this post as a request for other people to work on it. I just want this to be a place to keep track of my ideas and get feedback from the community.

Update Jan 13, 2020:

I need to release v0.1 with only the features I’ve completed so far (or that I’m about to complete) in order to meet my Jan 31 deadline. This means the Adaptive Card Builder (idea 5) and the Action Prompt (my renamed version of the Adaptive Card prompt) will have to wait for another release. Here’s a checklist that might give a better idea of the scope of this library and my progress:

Card Translation

  • Translate Adaptive Cards
  • Translate Bot Framework cards

Card Management

  • Apply ID’s to actions
  • Disable cards by tracking ID’s in bot state
  • Disable cards by updating their activities
  • Dynamically add or remove card elements
  • Adapt card actions between channels
  • Adapt submit actions between channels (Teams vs non-Teams)

Adaptive Card Builder

  • Generate an Adaptive Card based on a C# type

Action Prompt

  • Return values retrieved from a Bot Framework card or an Adaptive Card
  • Bind a specific card or cards to a prompt so input is not accepted from other cards
  • Validate Adaptive Card fields and give feedback for invalid entries

Testing

  • Translation tests
  • Management tests
  • Builder tests
  • Prompt tests

Documentation

  • Samples
  • Readme file(s)
  • Comments in code

Other languages

  • Node
  • Python
  • Java

Track my progress

https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/feature/cards/libraries/Bot.Builder.Community.Cards

Update Jan 28, 2021:

The cards library has been merged into the develop and master branches

Update Feb 18, 2021:

The cards library is on NuGet: https://www.nuget.org/packages/Bot.Builder.Community.Cards/

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:9
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
v-kydelacommented, Mar 27, 2020

Progress update: the project is mostly divided into the Translation folder and the Management folder, with the Management folder being many times more complicated. It handles card tracking by exposing functionality in three major classes: ManagementExtensions (for operations that don’t use bot state), CardManager (which requires a state accessor), and CardManagerMiddleware (which uses a card manager). I have written tests for ManagementExtensions and CardManager. Once I’ve finished the tests for CardManagerMiddleware then I’ll be able to create a card manager sample and finally demo this project.

I think a big reason why this took a lot longer than I anticipated was because of the decision to include Bot Framework rich cards because I have to take many different situations into consideration. Adaptive Cards are pretty consistent with how they work, but rich cards behave a lot more differently on different channels than I realized and my library attempts to adapt their functionality. It wasn’t a bad decision, but if I was just doing Adaptive Cards then I may have gotten to this point at least a month sooner.

Once a usable version of the current cards library is released as a NuGet package, I will move on to the Adaptive Card builder portion and action prompt portion of the library. I have my hopes up that they won’t be quite as time-consuming.

2reactions
v-kydelacommented, Jan 9, 2020

I should mention that the scope of this idea has increased somewhat since I think that much of what people want to do with Adaptive Cards also applies to other rich cards (like disabling them), so I’m now just calling this the cards library. I’ve been working on this pretty heavily over the last month and I’ve been pushing my progress in the feature/cards branch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bot Framework Community - .NET Components & Extensions
A collection of Prompts for use with Bot Builder v4, providing the ability to prompt using Adaptive Cards and for recognizing currencies, age,...
Read more >
Add card actions in a bot - Teams
In this module, learn what are card actions in Microsoft Teams, action types and how to use them in your bots.
Read more >
Bot Framework V4 BotBuilder .NET Core - #7 - Adaptive cards
See how to add adaptive cards to your chatbot! Adaptivecards.io https://adaptivecards.io/ Code ...
Read more >
Bot Framework v4 SDK Templates for Visual Studio
Microsoft Bot Builder V4 Templates will help you build new conversational AI bots using the Microsoft Bot Framework v4. Templates. There are ...
Read more >
Using Adaptive Cards with the Microsoft Bot Framework
Introduction. Adaptive Cards are a way to present a self-contained UI to a user within a larger UI such as a chat client....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found