We're recently released an exciting new feature in Botfront Cloud: conversational forms.
If you're familiar with Rasa and Rasa's
FormAction you will find a lot of similarities, as Botfront is based on Rasa. We have ported the Rasa's developer experience to an intuitive interface allowing to create forms in minutes. Under the hood, it still uses the
In this tutorial series we'll go through all the steps create a simple but resilient lead generation form.
A form that allows a natural experience where user can ask clarifications, make and correct mistakes, and provide information in different ways,
- Part 1: Getting Started
- Part 2: Handling Interruptions and Side Questions
- Part 3: Handling Contextual Questions and Adding NLU
Slot filling is a process where the virtual assistant collects a certain amount of information before to proceed.
- Collect the necessary input to invoke an API (e.g. cities and dates for a flight search)
- Collect lead information on your website.
The main difference with a regular story based conversation flow is that the assistant automatically iterates through the questions it needs to ask to gather the information. You don't need to model this part. You will use stories to control how the form is invoked and how deviations from the happy path are handled.
We'll start small to get a good understanding of how forms work. In this first step we'll suppose the user is collaborative and answers questions exactly as expected.
In order to make this form work, you will need at least the following in your policies:
policies - name: AugmentedMemoizationPolicy - name: FormPolicy - name: KerasPolicy epochs: 100
You can set your policies in the Stories screen using the Policies button on top of the sidebar.
We first need to create a form. We'll name it leadgen_form, add an informative description, and specify the three slots we want to collect:
We'll also enable the collect in Botfront switch in order to retrieve form submissions in the Incoming section:
When we save, Botfront will create (unfeaturized) slots for us if they don't exist, and show them in the left sidebar under the form. You can re-order them if you'd like the questions to be asked in a different order.
Once the form is created we can configure the slots. Configuring the slots means for each slot:
- Define a question to ask.
- Validate the user response and provide error and confirmation messages.
- Define how to extract the slot value from the response.
We'll set the following:
- The question to ask is "What is your first name?"
- The validation simply requires a response with more than one character
- In the extraction tab we state that the slot will be filled with the whole content of the user message.
Now let's do the same for the
work_email slot. The only difference here is that we want to make sure it's a valid email address:
Here it's slightly different since we are interested in ranges rather than an exact number.
We'll offer buttons to the users. The range will be set as an entity in the quick reply payload.
In the extraction tab, we need to tell Botfront where to extract the value from, since it's not a entire text message.
We simply specify that the value needs to be take from the entity
company_size, and we condition it on the
inform intent. More on that later.
Now that our form is configured, we can use it in a story.
Our story will start with the intent
This is just to have a way to get into the form
Then we start the form. Remember that when the form is active, it iterates through all the questions and utter your error or confirm messages depending on the validity of the user responses. None of this needs to be in your stories.
That is why you need to explicitly pick up after completion, when all the slots have been filled.
Now we can train our assistant and try to fill the form.
Finally, we can export form submissions in CSV in the incoming section as follow:
We have covered the basics of setting up a conversational form. However the functionality is very limited:
- It is not possible to exit or interrupt the form.
- It is not possible to ask clarifications or questions.
- It works if the user utters the expected response as a single word, but not in a sentence, such as My name is Nathan.
We will cover all this in the rest of this series, starting with Part 2: Handling Interruptions and Side Questions.