Search code examples
node.jsdialogflow-es

I want to retrieve the value of the parameter of the previous intent in dialogflow


I have a dialogflow bot that asks for firstname,lastname,dobday,dobmonth,dob year individually from the user(so I have 5 intents in DF and 5 seperate intent.js files for each field in webhook ).
I want to validate the dob in such a way that when the user gives the month ,bot should validate whether the user is entering the days in correct format.This should be in Nodejs

example:

Bot:Hi,please enter your first name
User:John
Bot:your last name
user:Sally
Bot:your dob month?
User:02
Bot:your dob day?
User:31
Bot:sorry,this is invalid dob

I created a seperate intents for each of the fields and validating in webhook for each field using nodejs.I am not sure how to proceed for this type of validation.For this,do I need to use any contexts or followup intents?If I have to validate dob day in a seperate .js file ,I need to retreive the month value retained from the user.

Till now: I have validated the date of birth month that I get from the user .I am new to Javascript and node js.

enter image description here

enter image description here


Solution

  • I recommend you to save the information in a context. then you can retrieve the data on whatever intent that is in the same context.