I am new to DialogFlow and chatbots in general. From the tutorials I'm following, it seems to be fairly straightforward to take data from the chatbot and send it to the backend via the webhook and then get the fulfilment response back to the user. However, I was wondering if there is any way to retain the parameters the user has input before the webhook was invoked and thus continue the conversation from where it left off.
For instance, say I've made a recipe bot. The user enters ingredients, say, flour, butter, eggs, vanilla essence and sugar that they have in their pantry. The webhook is invoked and it sends these parameters to the backend (flask based in my case). The ML at the backend identifies a set of recipes that could be made with these ingredients (mostly cake) and returns the most promising one.
If the user now remembers that they actually are out of vanilla essence but have chocolate, they should be able to update the chatbot with that one detail and have the bot come up with another recipe.
I'm not sure how to do that. My chatbot essentially resets the parameters when the fulfillment response is returned. I tried using Output Contexts to return the input parameters to the bot - and I can see the returned parameters - but they don't seem to be accessible.
Update: Another person has tried this, which is very similar to what I've done:
I have two intents. The first one (intent1) asks for a fruit (that value is saved in $firstParameter), and let's say the user sets it to "Apple".
function intent1() {
//does something with agent.parameter.firstParameter
console.log(agent.parameter.firstParameter);
}
This outputs:
Apple
No issue. Then, there's a follow-up intent, intent2, that asks for another fruit (that value is saved in $secondParameter) and lets say the user sets it to "Orange".
function intent2() {
//does something with agent.parameter.firstParameter and agent.parameter.secondParameter
console.log(agent.parameter.firstParameter);
console.log(agent.parameter.secondParameter);
}
This outputs:
undefined
Orange
The output context of the first intent activates the input context of the second intent, but the parameters are erased from existence, vanished, deleted, sent back into the void, cast into the fire, destroyed.