Introduction
In this article I will explain about FormFlow using bot builder SDK for .NET. Using Microsoft bot framework with FormFlow designing we can have a conversation with the user for getting the information from them. It means that the bot will ask the questions and gather the responses from the user. It automatically generates the dialogs that are necessary for managing the conversation based on the guidelines that we specify. The FormFlow is different from the LuisDialog. FormFlow guides for completing the form, whereas the LuisDialog evaluates the input.
Prerequisites
- Visual studio 2017
- Microsoft bot framework.
Creating the FormFlow project
Step 1
Open Visual Studio 2017, click->File->New->Project.
Step 2
Select the bot template and provide a name for the project as per your desire and click->ok.
Step 3
After the project is created, now we need to update the NuGetPackages, since the visual studio contains the basic NuGetPackages by default, we just need to update the packages. For updating the package, right click->project and select Manage NuGetPackages.
Step 4
Browse for NuGetPackage named “Microsoft.Bot.Builder” and select the NuGetPackage and update the package to latest version for proceeding to further steps.
Step 5
After updating the NuGetpackages, right click->project and select->Add->NewItem.
Step 6
Now we will create a class that contains the logic of FormFlow and provide a name for the class and click->Add.

Step 7
By creating a new class in the project, replace the c# class code in “form.cs” and save the file.
- using System;
- using Microsoft.Bot.Builder.Dialogs;
- using Microsoft.Bot.Builder.FormFlow;
- namespace HelloFormFlowBot {
- [Serializable]
- public class ProfileForm {
- [Prompt("What is your first name? {||}")]
- public string FirstName;
- [Prompt("What is your last name? {||}")]
- public string LastName;
- [Prompt("What is your gender? {||}")]
- public Gender Gender;
- public static IForm < ProfileForm > BuildForm() {
- return new FormBuilder < ProfileForm > ().Message("Welcome to the profile bot!").OnCompletion(async(context, profileForm) => {
- await context.PostAsync("Your profile is complete.");
- }).Build();
- }
- }
- [Serializable]
- public enum Gender {
- Male = 1, Female = 2
- };
- }


Sairam Sekhar PoluruPosted Jun 29, 2018, 4:56 AM
I need a speech enabled form in C#