Search code examples
botframework

How to display adaptive card selected option as if the user typed it in?


By default when we use adaptive cards in a waterfall dialog, the bot records the selected action and process the next waterfall step - how it actually looks

Instead can we display the selected option in the adaptive card as if the user typed in the option like - What I want it to look like

I have a requirement where we want to display it as if the user typed it in and not like the bot says "you selectd X option".


Solution

  • You can do this by using the 'data' property in your Adaptive Card.

    {
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "type": "AdaptiveCard",
        "version": "1.0",
        "body": [
          {
            "type": "TextBlock",
            "spacing": "medium",
            "size": "small",
            "weight": "bolder",
            "text": "",
            "wrap": true,
            "maxLines": 0
          },
          {
            "type": "Container"
          }
        ],
        "actions": [
          {
            "type": "Action.Submit",
            "title": "Policy",
            "data": "Policy"
          },
          {
            "type": "Action.Submit",
            "title": "Scheduled",
            "data": "Scheduled"
          }
        ]
    }