简体   繁体   中英

Audio Payload Dialogflow (api.ai)

I'm making an action for the Google Assistant. I do have a javascript fullfilment but it's not really a good clear code it works so it's fine. By example, I don't know how to call an intent in js. But on to my question: is it possible to use the custom payload response for audio files? I know you can play audio files with the webhook but it would be lovely if it just possible in de custom payload.

I want my welcome intent to have an audio response. If it's not possible how do I call the welcome intent in js?

My webhook now: 在此输入图像描述

It depends what you mean by the "custom payload" and exactly how long the audio you want to play is, but there are a number of ways you can play audio that you have configured from the Dialogflow settings. You can also play it from PHP using similar methods in some cases.

Playing short audio

Your speech responses can include SSML markup which can include an <audio> tag that includes audio. This audio must be under 120 seconds long . So you can have something like this:

<speak>Welcome to my action! <audio src="https://actions.google.com/sounds/v1/alarms/bugle_tune.ogg"></audio> How can I help you?</speak>

either in the Response Default tab or if you add a Simple Response in the Google Assistant tab. In the Default tab, it looks something like this:

在此输入图像描述

If you're making a response for the Google Assistant only, you can do it in that tab by clicking on the "Google Assistant" tab and then "Add Responses"

在此输入图像描述

You can then select a "Simple Response" to add and enter the SSML.

在此输入图像描述

在此输入图像描述

Playing longer audio

If your audio is longer than 120 seconds, you can add a Media Response to the Google Assistant response. You need to have a Simple Response already set and then click "Add Responses" to add another.

在此输入图像描述

You may need to scroll down to select "Media Content".

在此输入图像描述

Then add the information for the content. You need to provide, at a minimum, a name that will be displayed on screen-based devices and the URL for the audio.

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM