tompaana / dynamic-form-flow-sample

This sample demonstrates how to add dynamic features to form flows of a bot built on Microsoft Bot Framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic FormFlow Sample

This sample demonstrates how to add dynamic features to FormFlow implementation of a bot built on Microsoft Bot Framework. The central points are explained in my blog post creatively named How to Create Dynamic FormFlow.

The approach implemented by this sample is especially useful for scenarios where the user is searching an item from an existing catalog. Instead of displaying all the options for narrowing down the desired item, we only display options available based on the data previously collected. In some cases we can skip part of the queries altogether as they have but only one option. See the three example flows below.

Few examples of the flow:

Flow 1 Flow 2 Flow 3
Flow 1 Flow 2 Flow3

Important classes

Spaceship represents the item we are searching for and its properties. This is the class the FormFlow takes and starts filling values with.

SpaceshipData contains the catalog and some helper methods.

SpaceshipSelectionForm contains the FormFlow builder and the methods implementing the dynamics: checking if the fields (queries) are necessary, what options should be available and response validation.

SpaceshipSelectionDialog is the root dialog of the bot and takes control of the flow once the FormFlow is finished. If more than one option remains, it will display a carousel of the spaceships left for the user to choose from.

See also

About

This sample demonstrates how to add dynamic features to form flows of a bot built on Microsoft Bot Framework.

License:MIT License


Languages

Language:C# 99.0%Language:HTML 0.8%Language:ASP 0.2%