Digital Assistant and Mobile

Get Involved. Join the Conversation.


    Sharath Chandra Gavini
    Add delay to consecutive messages
    Topic posted May 15, 2019 by Sharath Chandra GaviniBronze Medal: 1,250+ Points, last edited May 15, 2019, tagged Bots, Conversational AI 
    98 Views, 4 Comments
    Add delay to consecutive messages
    How to add a delay to the messages sent from the custom components

    Hi all, 
    I have a component where I am sending multiple text responses one after the other. All the messages appear at once and it doesn't give a good chat experience. I want to add delay to the messages so that it appears more realistic. I tried adding timeouts and promises but that didn't work. Is there any way of achieving this?
    Thanks in advance,
    Sharath Chandra Gavini.



    • Rohit Dhamija

      Hi Sharath,


      An enhancement request is logged for the same. However in mean time the purpose can be served by building a custom component to add the desired delay.

      Just created a custom component for POC purpose , please find the code here

      The code contains sample skill, custom component code . Please try the same and let know if it helps.



      • Sharath Chandra Gavini

        Thanks a lot Mr. Rohit for the answer. I really appreciate it. I checked the code out and I found it is a component that needs to be invoked everytime there needs to be a delay.
        My usecase is a different one. I want to add a delay to the messages that are sent from the same component using the conversation.reply() method.

        Is there any way of achieving that?

        Sharath Gavini

    • Rohit Dhamija

      Hi Sharath,

      Thanks for your reply,

      How about adding

      conversation.reply(`I slept for ~${diff} milliseconds`);  

      after the delay, I updated the code, can you please check if it serves your purpose?


      • Sharath Chandra Gavini

        Thanks a lot for the quick reply.
        But that doesn't solve my problem.
        My requirement is:


        All these should happen inside a single custom component. What I observed is that all the messages sent using the reply() method are being queued up until done is called and then are sent all at once. Is there any way to alter this behavior of the SDK?

        Sharath Gavini.