0
votes

Output

I am using Bot Framework .Net SDK v4 and direct line web chat client. I have my dialogs as waterfall steps. Is it possible to use a suggested action inside a waterfall step? I am aware that a choice prompt will serve the purpose but I want the buttons to disappear after user clicks any choice, hence want to use suggested actions.

What I have tried.


In the constructor :
AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));

In waterfall step:

  public async Task<DialogTurnResult> FirstStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var promptOptions = new PromptOptions()
            {
                Prompt = MessageFactory.Text("What card would you like to see? You can click or type the card name"),
                RetryPrompt = MessageFactory.Text("That was not a valid choice, please select a card or number from 1 to 9."),
                Choices = GetChoices(),
                Style = ListStyle.SuggestedAction
            };

            return await stepContext.PromptAsync(nameof(ChoicePrompt), promptOptions);

        }

        private IList<Choice> GetChoices()
        {
            var cardOptions = new List<Choice>()
            {
                new Choice() { Value = "Card 1", Synonyms = new List<string>() { "adaptive" } },
                new Choice() { Value = "Card 2", Synonyms = new List<string>() { "animation" } },
            };
            return cardOptions;
        }
1

1 Answers

0
votes

in the the prompt options you can specify you choices style :

var promptOptions = new PromptOptions {
  Prompt = (Activity) MessageFactory.Attachment(card.ToAttachment()),
  Style = ListStyle.SuggestedAction 
};
return await stepContext.PromptAsync(nameof(ChoicePrompt), promptOptions, cancellationToken);



// Auto: Automatically select the appropriate style for the current channel.
// HeroCard: Add choices to prompt as a HeroCard with buttons.
// Inline : Add choices to prompt as an inline list.
// List : Add choices to prompt as a numbered list.
// None: Don't include any choices for prompt.
// SuggestedAction: Add choices to prompt as suggested actions.

source