I'm making an agent for Dialogflow for Google. Someone can ask 3 questions and after 3 questions, the conversation has to end. I want to end the conversation in the Fulfillment Inline Editor when a counter is 3. How can I do this? I tried this:

function Question(agent){
   if (counter == 3){
        agent.end(`OK, see you next time`);
   }
   else{
        agent.add(`OK, What is your next question?`);

   }
}

let intentMap = new Map();
  intentMap.set('Question 3', Question);

But this is not working. The Firebase logbook is not giving any errors and the agent is not responding. Can anyone help me?

0 Answers