Add a pause to chat bot

Highlighted
Regular Contributor | Gold Partner

I'm looking for a way to place a pause in the middle of a Lead Gen chatbot. 

 

Use case: User says they're looking for purchase locations. Bot directs them to look at the vendor locator page. Then, say 10 seconds later, prompts "Did you find what you need? [QuickReplies Yes and No]"

 

Obviously, we don't want those two messages to fire together.

 

I'm able to write a JS action to fire the post-pause "Did you find" prompt with the quickReplies, but when I put a setTimeout on it, no matter where I put it, either the callback fails silently or the timeout seems to fire BEFORE the previous ("go look at the vendor locator page") step, which looks like some async issue.

 

My snippet action:

exports.main = (event, callback) => {
    const responseJson = {
      "botMessage": 'Did you find what you needed?',
      "quickReplies": [
        {
            "value":"Yes",
            "label":"Yes"
         },
        {
            "value":"No",
            "label":"No"
         }
      ],
      "responseExpected": true
    }
      callback(responseJson); 
}

I know this chunk of code can handle other libraries, etc. Can it not handle a timeout, though?

 

Please note: I'm not looking to delay the entire chatbot loading.

Reply
0 Upvotes
1 Reply 1
Highlighted
Regular Contributor | Gold Partner

I have found that I was using 20000 for my timeout to make it super obvious, and anything over 19000 seems to terminate the chatflow. Also, my custom timeout step would fire (wrongly) before a preceding chat bubble, but not before a preceding question module.

 

One of the HS developers has seen this in a slack post and is collecting information on it.

 

 

Reply
0 Upvotes