Bot Framework Composer: Prompt for user input
A conversation between a bot and a user often involves asking the user, for information and parsing the user's response. Bot should track the context of a conversation, so that it can manage the behavior and remember answers to previous questions. Bot Framework composer has provided different question format, in this article we are going to see how we can use the Text, Number and Datetime input from users and How we can retrieve state information from Bot state.
Prerequisites
- Read my previous article to build and
setup the bot framework Composer development environment. - Read, How to create Multiple Dynamic Greeting message using Bot Framework ComposerCreate New Bot Application
Asking Questions to user
Bot Framework Composer makes it easier to collect information to the user and composer provided feature for validation and a variety of data types as follows - Text Input
- Number Input
- Confirmation
- Multiple Choice
- File or attachment
- Date or time
- OAuth Login
In this article, You are going to learn more about Text, Number and Date/Time Input format and how bot can ask questions to the users.
Composer Input Control Property – Bot Ask
- Ask question Input dialog has 3 category options - Bot Asks, User Input and other.
- Prompt Property -Create your custom message for Bot will send a message to the user
. - Max
turn Count – Maximum number of re- prompt attempts to collect information fromuser - Default Value - Expression to examine on each turn of the conversation as possible value to the property.
- Allow interruptions - A boolean expression that determines whether the parent should be allowed to interrupt the input.
User Input
User Input tab options have “Property to Fill”. It’s a Property to store collected information. Input will be skipped if the property hasBot Text Input Question
The Greeting conversation activity screen, you can click on the “+” button and select the Ask question options and click on Text inputStep 1: Add “Bot Asks” prompt of text in the text box, which you Bot required to ask questions to the user and the type of value will allow only as text
Step 2: If you want to save user input and display somewhere else or store into the database, you can select “user Input” section and add the variable property as - user
Bot Number Input Format
Bot can ask users to enter any number value using number input. To prompt a user for a number, click the + buttonIn this following example
- Bot asking users to enter the no of years’ experience and provided max turn count as 1 and provided default value as 2.
- Suppose users enter any text or any invalid character at one time, Bot will take as default value as 2.
- In user Input options Bot will save the value “user
. exp ” property, it will be helpful forretrive somewhere else.
Bot Date Time Input Format
Bot Date Time Input format control which is returned as a Timex.- You can add the “
Bot Ask ” questionto the Prompt text box - Create
Property for store thedatetime value, here property as “user. date”. after asking for a date, the bot returns a Timex into “user. date” like below
Because it's a
great article thanks for share thisarticlee
ReplyDelete