Azure Bot Dynamic Input Fields - botframework

Can we add & delete input fields dynamically in an Adaptive Card?
We need to have button called as "Add New", as user clicks on button it should keep adding input fields along with a delete button next to it.
We are using composer based bot with .Net SDK for bot development.

I don't think there is anyway to do exactly what you are seeking. But perhaps some combination of ShowCard and ToggleVisibility?
Either way, it will be done via the adaptive card. No way to do this in the bot framework side (unless you are using a channel that supports updating/replacing an entire activity in which you would just send a whole new card).

Related

Is it possible to show "current meeting attendees" via an Adaptive Card?

I have somewhat of a unique use case where my team needs a 24-hour conference bridge. To keep the Teams chat threads from getting too long, I currently re-create the conference bridge via a Flow once each month. The Flow creates a new meeting invitation and posts an adaptive card with a "join" button that has a direct link into the current meeting.
One feature we're missing from the "meet now" or "schedule a meeting" feature in our team channel is the faces of the people that are currently present in the meeting. Is it possible to recreate this via the adaptive card? Or, is there another way for me change to flow to maybe post a "meet now" message once per month instead of a custom adaptive card?
Please let me know if you want some more detail or if my request doesn't make sense for some reason.
Thanks ahead of time!
You can create a deeplink to schedule a meeting using
https://teams.microsoft.com/l/meeting/new?subject=<meeting subject>&startTime=<date>&endTime=<date>&content=<content>&attendees=<user1>,<user2>,<user3>,...
and you can specify this as the URL target in your card's button or tap action through the openUrl action type. For more details please go through the documentation.

Data is getting wiped out once submit action taken on adaptive card

"adaptivecards": "^1.2.6",
We are using adaptivecards package with bot framework in spfx solution.
Reference link: https://github.com/pnp/sp-dev-fx-webparts/tree/master/samples/react-adaptivecards
Details
Data is getting wiped out once submit action taken on adaptive card. We are using below adaptive card package:
"adaptivecards": "^1.2.6",
Issue
a. When a user provides inputs to cards all data are seen whatever user has provided as input.
b. As soon as a user submits an action button on that, a request is submitted to bot with all user input data.
c. An issue is all user input data are wiped out.
Before Submiting Card:
After submit card get reset
This isn't a thing that happens in Web Chat. It used to be a thing that happens in Teams, but it seems like they changed the Teams behavior a while ago. The only reason this could happen in Web Chat is if you wrote custom code to make it happen in Web Chat. Out of the box, Web Chat simply doesn't have this problem.
My recommendation is to remove the code that's resetting your input fields. Failing that, you can write new code to set the input fields based on the submitted data.

How to read choiceset values in Bot dialog that are selected in Bot adaptive card using Composer dialog

How to read choiceset values in Bot that are selected in Bot Adaptive Card, I am using Bot Composer to develop the Bot. I need multi select, so used Adaptive card and used send response in bot composer dialog to display the adaptive card. But not able to read the value in subsequent actions in the dialog. Amy samples/ references based out of Bot Composer.
More details are needed as mentioned.
You should review the response from the user in Botframework Emulator, and then inspect to see what the return values look like.
You can then retrieve it in the bot with something similar to =turn.activity.value._answer_ (answer here was just a sample of what that may be. Your data will be different of course).
I think you are trying to save the user selection from adaptive card.
You can use Ask a question --> Text template, instead of using send response.
In Prompt for text section you can use HeroCard/AdaptiveCard. In User Input section declare a variable that will store the user selection coming from HeroCard/AdaptiveCard. Depending on the variable scope you can reuse the stored data in the variable later in the conversation.

How to update an existing activity in WebChat

My scenario is: I send card attachments each with an AcceptButton to users. When 1 user clicks on that button, ideally I want to disable all similar buttons (of the same offer) for all users. I am storing conversation details of each user, and I know the ActivityId of each message-with-said-button (it follows a certain string format).
My issue is similar to this and this but for WebChat not Teams.
I did try those solutions but I got the error "Method not allowed" for both UpdateActivityAsync() and DeleteActivityAsync(). Then I read here that UpdateActivity is not supported in WebChat. (But might be available in the future?)
I would like any visual indication that the offer is no longer available. (Right now, they receive an "Offer was already accepted by {UserX}" which would still be in place on top of changing the card/message.)
Is there a way to do this via backChannel? I can trigger an event and pass the ActivityId (tested by showing a simple alert()) but how do I apply changes to that specific activity?
Per this comment in Web Chat's source code and this open issue in the Web Chat repository for adding support for deleteActivity and updateActivity, Update Activity events are not currently supported in Web Chat. Unfortunately, there is currently no way to really update an activity in Web Chat.
Hope this helps!

How to use AdaptiveCards with a LUIS based Azure WebApp Bot (Microsoft BotFramework) C#

I have a WebApp Bot enabled in the Skype for Business channel, the purpose of the bot is to do a SQL Query and return some data i.e. Query: "Who is Joe Bloggs", Response: "Name: Joe Bloggs, Mob: 07123456789, JobTitle: Associate" etc..
I want to have this information returned as an adaptive card rather than just text, so was looking at how to do this. The tutorials show how to implement this using C# on a generic chatbot, but is not specific enough on where in a LUIS bot I would add this code (as LUIS is passing the message around for Intent Recognition, so is more complicated than simply 'if activity type is Message, attach AdaptiveCard').
Would it be the MessageController.cs? or the BasicLUISDialog.cs perhaps?
Unfortunately, while SfB currently supports Hero Cards, it does not support Adaptive cards at this time. You can check which channel supports which format at this link:
Channel Inspector
That being said, cards are created in the dialog, not the controller. You'd make them in the BasicLUISDialog.cs.
SFB provides a very limited functionality wrt user styling. Buttons and javascript is not supported. You can color and change size of text your text using some html.

Resources