Meed095
Meed095

Reputation: 63

using formflow with botbuilder v4

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 :

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

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

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");
            }
        }

Upvotes: 0

Views: 393

Answers (2)

David
David

Reputation: 1196

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/

Upvotes: 1

Kyle Delaney
Kyle Delaney

Reputation: 12284

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

Upvotes: 1

Related Questions