Warm tip: This article is reproduced from stackoverflow.com, please click
botframework

Any examples of using Adaptive Card as Input Form in Composer?

发布于 2020-04-07 23:22:33

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. snapshot from Composer

Questioner
dinobrago
Viewed
176
mdrichardson - MSFT 2020-02-01 05:18

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.

  1. If condition, Condition: turn.activity.value && !turn.activity.text
  2. On the True branch, Send a response: - '@{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):

image

See this GitHub issue for more information.