TLDR; (title) How to assign a default value to a required parameter via Dialoflow Fulfillment?
Long question:
I have these 2 required parameters. user_id and user_pin.
I utilized Fulfillment webhook call for slot-filling and everything seems to work well except this behavior:
After an API call to the database to verify if user_id and user_pin matches and they do not match, Dialogflow chatbot responds with "Incorrect user pin please provide the correct pin."
User then provides another user_pin but Dialogflow triggers the slot-filling and asks for the user_id again. - "Please provide a user ID".
I don't want it to ask for the user_id again. So to fix that, after an incorrect user_pin is provided, I created a context: "incorrectPinContext" with parameters {user_pin:user_pin}. I then set the default values to:
user_id = #incorrectPinContext.user_id
This fixes the problem as Dialogflow is smart enough to know if user_id is already provided or not and no longer asks again for user_id. But all of the default value assignment I've done was only through the console / UX of Dialogflow not in fulfillment. I've browsed through Google's documentations but cant seem a reference on how to do that.
So that brings me to the question: How to assign a default value to a required parameter via Dialoflow Fulfillment?