Slot filling simplifies your conversational design and allows you to obtain multiple required parameter values for the intent from your chatbot user.
Let’s get back to our simple pizza ordering chatbot and its core “order_pizza” intent. When building this intent, we’ve introduced a “pizza_type” entity that allows customers to specify what kind of pizza they would like to order – Margarita, Four cheese, etc. Obviously, until the chatbot has this parameter in place, the delivery process cannot be started.
Imagine adding other parameters to the intent – like “pizza_extras”, “delivery_address”, “delivery_time” etc. If we had to check every parameter, the complexity of the skill will grow exponentially.
Luckily, if you’re using a Dialogflow agent for natural language understanding there’s a better way – slot filling.
When you create the intent definition in Dialogflow, you can mark some (or all) parameter values as “required”. In this case, Dialogflow will keep prompting the user until these values are in place. It will use pre-defined questions to fill in the value of each parameter and mark the intent as complete only when every parameter is available.
To set slot filling prompts in Dialogflow, go to the intent definition and click the “Required” checkbox to the left of the parameter name. Then click the “Define prompts” link and enter some variations of the question that will help chatbot users fill in the value.
Declaring intent parameters as required
When you click “Define prompts”, a pop-up will appear and you will be able to enter some variations of the question that Dialogflow will ask to set the value of that parameter. As with multiple responses, one of the variations will be picked up randomly to make your chatbot conversation feel more human.
Defining prompts for “pizza_type” parameter entity
Do not forget to click “SAVE” when you’ve finished adding prompts.
Now, if you test your intent in the console and do not specify pizza type in the original utterance, Dialogflow will use these prompts to help you complete the intent.
Slot filling in Dialogflow console
To use a native Dialogflow slot filling with Activechat, you will need to make a small change to the skill that handles that intent. We’ve built the integration for maximum flexibility, so you can choose how exactly the slots should be filled – either with Dialogflow prompts or with extra questions in the skill itself.
When Dialogflow detects a specific intent in the user’s utterance, the skill for that intent will always be triggered immediately, even if there are some required parameters missing. But you can use the $_nlp_action_complete system attribute to check if the parameters are in place. The value of this attribute will be “true” when all required parameters are available, and “false” otherwise. If some parameters are still missing, prompts from Dialogflow will be available in the $_nlp_speech attribute.
Use this logic to make Dialogflow slot filling work with Activechat integration:
How to do Dialogflow slot filling in Activechat
IMPORTANT: if you’re using Dialogflow-style slot filling, make sure you select “New session: No” in the NLP block settings. Otherwise, each request to Dialogflow will create a new session and the history of slot filling will be lost.
Disable the “New session” in the NLP block settings
Click “RUN” to build your chatbot and deploy it to the cloud, and test your slot filling in the Messenger:
Slot filling in the actual chatbot conversation