using formflow with botbuilder v4

379 views Asked by At

Hy everyone,

For a project, i have to create a chatbot, first the user should choose a number betwen 1 and 5. At the end if the user write 1, the bot ask you to write :

  • Your first name,
  • Your last name,
  • Your phone number

after the bot return your name, your phone number and display the welcomeMessage

if the user write 2, the bot ask you to write :

  • Your adress,
  • your birthday

after the bot return your adress, your birthday and the bot display the welcomeMessage

i used formflow in the beginning but it didn't work because i use SDKBotBuilder V4.

    if (turnContext.Activity.Type == ActivityTypes.Message)
        {

            if ("1".Equals(turnContext.Activity.Text))
            {
                //name
                //phoneNumer
            }
            else if ("2".Equals(turnContext.Activity.Text))
            {
                //adress
                //birthday
            }
            else if ("3".Equals(turnContext.Activity.Text))
            {
                await turnContext.SendActivityAsync($"you choose 3");
            }
            else if ("4".Equals(turnContext.Activity.Text))
            {
                await turnContext.SendActivityAsync($"you choose 4");
            }
            else if ("5".Equals(turnContext.Activity.Text))
            {
                await turnContext.SendActivityAsync($"you choose 5");
            }
            else
            {
                await turnContext.SendActivityAsync($"choose a number between 1 and 5");
            }
        }
2

There are 2 answers

0
Kyle Delaney On BEST ANSWER

While FormFlow would be well-suited for this task, you are correct that there is no FormFlow in V4. However, V4 does have waterfall dialogs that may well be just as good for what you're trying to do. A waterfall dialog consists of waterfall steps that are like mini-dialogs that prompt the user for information. Have a look at the documentation to see how to use waterfall dialogs: https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-dialog-manage-conversation-flow

0
David On

FormFlow is now available for v4 just got to add the Nuget (more or less)

https://www.nuget.org/packages/Bot.Builder.Community.Dialogs.FormFlow/