Merlin -they-them-
Merlin -they-them-

Reputation: 2940

Google Assistant DialogFlow for Workout?

I'm making a simple assistant with no interaction other than the kickoff command words. Once it starts, I would like it to say various phrases after some amount of time.

I'm currently attempting this with DialogFlow Fulfillment with some setTimeout() calls, however it doesn't kick off the routine.

  1. Can I use setTimeout() for this? If not, what do I use to space the statements out
  2. How do I kick off the routine using Fulfillment?

Ideal flow

Upvotes: 2

Views: 62

Answers (2)

Prisoner
Prisoner

Reputation: 50701

Actions on Google and Dialogflow are conversational - most interaction is the user saying something, AoG/Dialogflow replying, and this process repeating. You can't use setTimeout() on the server, since the reply will already have been sent.

Your replies can include SSML markup to do the breaks you want, but your reply is still limited by overall length (about 2 minutes), and probably much shorter than the routine you're looking to do.

A better approach will be to do things that use a Media Response. This lets you send some text, followed by mp3 audio. When the audio is finished, it will send a message back to your server and you can send the next instruction (and audio). The downside to this is that the timing will not be precise - you can control the length of what you say and how long the audio is, but there will be some lag with the network round trip.

Upvotes: 0

nikhilesh_koshti
nikhilesh_koshti

Reputation: 403

It seems like in the fulfillment, you have to use an SSML tag. Use <break time=30</> for 30 second break or 15 second break.

Please refer the link for SSML in fulfillment:- https://developers.google.com/actions/reference/ssml

Upvotes: 2

Related Questions