0
votes

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.

1
It is difficult to diagnose the problem without seeing the actual code in question. Updating the question to show as much of the code as possible, along with the details of the error messages, and any other information you can can help us help you. See How do I ask a good question?Prisoner
Done. Hope this helpsAnkit

1 Answers

0
votes

Hey I think you are trying to handle all the response in the one intent that is First.

I just want to mention here, It always better and good practices to keep the default fallback and welcome intent handler. Some time it helps to understand why it is getting into that handler for what response text was?

Then you can manually train your that response and map also.

Try adding default handler in code and see what going there in this case.

This might help !