Are there any examples in Composer using an adaptive card input form (such as https://adaptivecards.io/samples/InputForm.html) and how to retrieve the information into the design flow?
All the examples I've seen so far as for formatting output data to the user.
The sample adaptive card collects name, email, & phone number. The form displays fine in Composer.
How do you use this form to collect information in Composer? There is no obvious way to use adaptive cards except as an output option.
Unfortunately, there isn't a great way to do this at the moment. Adaptive Card responses come in via Activity.Value
instead of the "normal" Activity.Text
. So, you just need to create a switch in the Unknown Intent trigger that watches for this.
turn.activity.value && !turn.activity.text
- '@{turn.activity.value}'
That takes care of the adaptive card part. The trick is getting it to trigger something else if turn.activity.value && !turn.activity.text
is false. For that, I have it launch a separate dialog on the False
branch (which is a simpler copy of the RespondingWithCards sample):
See this GitHub issue for more information.
Thanks. Hopefully this will become easier in the future. Perhaps my question should have been, is there any way to use a form to collect user data? Not specific to adaptive cards
@dinobrago No problem! Adaptive Cards are the closest things to forms that we have, currently. This isn't ideal, but you could alternatively 1) Create another endpoint for your bot that accepts forms, 2) Popup the form to the user, 3) Have the form send the data to the bot's forms endpoint. Something like that. Again, not ideal