Input
The input cards are useful when you need to ask the user for information and store it in a variable.
Input string
Ask the user about information and store it in a variable.

Syntax
[
{
"name": "<STATE_NAME>",
"component": "ebbot_input_string",
"properties": {
"text": "<TEXT_MESSAGE>",
"output": "<VARIABLE_NAME",
"ask_again": false,
"validation": {}
}
}
]Example Usage
[
{
"name": "state_1613081714484",
"component": "ebbot_input_string",
"properties": {
"text": "Whats your name",
"output": "name",
"ask_again": false,
"validation": {}
}
}
]Input pattern
Ask the user about information and match it against a regular expression before saving it to a variable. Useful when you need to validate the inputted informationen.

Syntax
[
{
"name": "<STATE_NAME>",
"component": "ebbot_input_pattern",
"properties": {
"text": "<TEXT_MESSAGE>",
"output": "<VARIABLE_NAME>",
"ask_again": false,
"pattern": "<REGEX_PATTERN>",
"error_message": "<ERROR_MESSAGE>",
"validation": {}
}
}
]Example Usage
[
{
"name": "state_1613081823403",
"component": "ebbot_input_pattern",
"properties": {
"text": "How old are you?",
"output": "age",
"ask_again": false,
"pattern": "^[0-9]{2}$",
"error_message": "Not a valid number",
"validation": {}
}
}
]Property
Description
text
The text message that should ask for the variable
output
Variable name
ask_again
Default value: false. Change to true if you like to always ask for the variable each time the card is triggered.
pattern
Regular expresson to match
error_message
Error message to prompt if the variable doesn't match the pattern
Using the variable
You can use the collected variable in a response card by placing the variable name inside double curly brackets.
"text": "Hello, my name is {{ name }} and I'm {{ age }} years old"The variable is also accessible in a custom component.
def main(data):
age = data['db']['age']
name = data['db']['name']Last updated
Was this helpful?

