actions-on-googleactions-builder

Delaying speech and text between Scenes


I have both a speech and text Prompt in a Scene and in the Scene that is transitioned to. The separate speech prompts are spoken with just a brief break between them. The text prompts are displayed as sentences in the same paragraph. Ideally, I would like a pause between the speech prompts, and a new paragraph between the text prompts.

How might I do this?


Solution

  • Scenes represent logical separations - not necessarily discrete UX elements. Each scene can put one or more prompts into the prompt queues (there are multiple queues - more on that in a moment). They're taking out of each queue in the order they were put in, unless you clear the queue before you add another item. However - the system treats all of the prompts in the queue as building towards a single reply. So there is no automatic way to visually or audibly separate them.

    However, there are a couple of tricks you can use, with caveats.

    Audibly, you can add a brief pause using the SSML break tag. So you might set your On Entry "speech" prompt response to something like:

    <break time="250ms"/> Welcome to another scene.
    

    However, splitting the response visually is more difficult. There is no formatting allowed in the text response. There are a couple of tricks you may be able to try, however, but they're not guaranteed to work on all visual displays.

    The easiest might be to send the first part of your response as a firstSimple prompt, and the second part in a lastSimple prompt. Typically you'd use the first to give results from what the user might have just done, and the last to prompt them for further action, but they may be rendered as separate "bubbles" on some platforms.

    You could also consider a rich response card. You an format the contents of the card a little, but you can't use two separate scenes to fill the contents of a single card. On some platforms, you can only show one card.