Delays

Specify some time between states in your flow

All states in a flow support the delay attribute that can either specify a relative delay (in seconds) or an absolute delay (in UNIX time as seconds since epoch). Pystache syntax is supported for both types of delays.

Delays occur between the state the defines the delay and the state that is being transitioned to next. In other words, the state containing the delay definition is not the state that is delayed; the following one is.

Relative delay

The simplest way to integrate timing features into your bot is to add a small relative delay between subsequent messages.

📘

Decimal relative delays are support (eg relative: 0.5). However, practically very short delays less than 300 ms will be difficult to achieve reliably due to server and network latency.

states:
    first:
        component: meya.text
        properties:
            text: "Ticking away the moments that make up a dull day."
        delay:
            relative: 5
    second:
        component: meya.text
        properties:
            text: "Waiting for someone or something to show you the way."
        delay:
            relative: 10
    third:
        component: meya.text
        properties:
            text: "Thought I'd something more to say."

Absolute delay

You can also specify absolute delays:

states:
    first:
        component: meya.pass
        delay:
            absolute: 1483228800
    second:
        component: meya.text
        properties:
            text: "Happy New Year!"

👍

Tip!

The delay property forces state transitions to be asynchronous. You can set a short delay (<200ms) to have messages render as they're ready. This is useful if one step of your flow takes a long time.