I am building an open ended question answer using dialoflow. I am using node js in my webhook. I want the questions asked to stopped as soon as app asks the last question. In order to get that I am using length property of array:
var length = questions.length;
But as soon as this line is executed the error is shown that:
Error: Dialogflow IntentHandler not found for intent: Default Welcome Intent at Function.
However I am not using this Default Welcome Intent in the webhook. The response for this intent is set in the default response section. As soon as I remove the length line the code does not give any error.
Can you help me resolve this error or give any other ideas as to how to get the length of the array?
This is the code I am using:
app.intent('First', (conv) => {
const ans = conv.parameters.any;
if(type[0] === 'RATING'){
if(ans == 1){
senddata[0] = qstion[0] + ans;
conv.ask(qstion[1]);
}
else if(ans == 2){
senddata[0] = qstion[0] + ans;
conv.ask(qstion[1]);
}
else if(ans == 3){
senddata[0] = qstion[0] + ans;
conv.ask(qstion[1]);
}
else if(ans == 4){
senddata[0] = qstion[0] + ans;
var length = qstion.length;
conv.add(length);
conv.ask(qstion[1]);
}
else if(ans == 5){
senddata[0] = qstion[0] + ans;
conv.ask(qstion[1]);
}
else if(ans === 'can you help me' || ans === 'help' || ans === 'help me'){
checkhelp_logout = "help";
flag_log_help = 2;
conv.ask('Would you like some help?');
}
else if(ans === 'logout'){
checkhelp_logout = "logout";
flag_log_help = 2;
conv.ask('Did you say logout?');
}
else if(ans === 'sign out'){
checkhelp_logout = "logout";
flag_log_help = 2;
conv.ask('Did you say sign out?');
}
else if(ans === 'exit'){
checkhelp_logout = "logout";
flag_log_help = 2;
conv.ask('Did you say exit?');
}
else{
conv.add('Please enter a valid number');
conv.ask(qstion[0]);
}
}
else{
senddata[0] = qstion[0] + ans;
conv.ask(qstion[1]);
}
});
You can see the length property in the if condition where ans == 4. This is the error: Error: Dialogflow IntentHandler not found for intent: Default Welcome Intent at Function.