0

I use Dialogflow chatbot with voice recognition. My goal is manage external device via Dialogflow. External device can change the state in time range from 30 sec to 30 minutes.

Device state have to be taken in consideration by chatbot via fulfillments. According the documentation it is possible to do that via request-response method and time is 5 second. In ideal case I assume to make bidirectional communication via socket but it is not possible in Dialogflow.Could you please advise me the solution or point me other chat engine with voice supporting that functionality? I read that Dialogflow CX supports sessions up to 30 minutes but it is not a waiting time.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Vlad Tagunkov
  • 359
  • 1
  • 3

1 Answers1

1

You can extend the 5-second Intent limit up to 15 seconds by setting up multiple follow-up events. Currently, you can set up only 3 follow-up events one after another. You can extend the timeout up to 15 seconds.

Here, you can see more documentation about custom events.

Here's an example of how you can do it in the fulfillment center:

function function1(agent){
      //This function handles your intent fulfillment
      //you can initialize your db query here.
      //When data is found, store it in a separate table for quick search
    
      //get current date
      var currentTime = new Date().getTime(); 
      
      while (currentTime + 4500 >= new Date().getTime()) {
        /*waits for 4.5 seconds
          You can check every second if data is available in the database
          if not, call the next follow up event and do the 
          same while loop in the next follow-up event 
          (up to 3 follow up events)
        */
        
         /* 
         if(date.found){
            agent.add('your data here');//Returns response to user
         }
          */
      } 
      
      //add a follow-up event
      agent.setFollowupEvent('customEvent1'); 
     
      //add a default response (in case there's a problem with the follow-up event)
      agent.add("This is function1");
  }
 
  let intentMap = new Map();
  intentMap.set('Your intent name here', function1);;
  agent.handleRequest(intentMap);

Here, you can see more documentation about Webhook service and Fulfillment.

Raul Saucedo
  • 1,614
  • 1
  • 4
  • 13
  • Really thanks for that reply! I have already know that trick but my idea to extend that time to 30 minutes. Probably it is not possible with end-to end solution with #Dialogflow. – Vlad Tagunkov Oct 26 '21 at 20:53
  • 1
    Maybe these will help you. Reviving the previous session state . https://cloud.google.com/dialogflow/cx/docs/concept/session#long-lasting – Raul Saucedo Oct 26 '21 at 21:04
  • Thanks for that information. I saw it previously, but not take in to attention in details how it works. Now re-read it 2-3 times and hope it helps me. – Vlad Tagunkov Oct 28 '21 at 15:47