首页 文章

音频有效载荷对话框(api.ai)

提问于
浏览
2

我'm making an action for the Google Assistant. I do have a javascript fullfilment but it'不是一个很好的清晰代码,所以它知道如何在js中调用一个intent . 但就我的问题而言:是否可以对音频文件使用自定义有效负载响应? I know you can play audio files with the webhook but it would be lovely if it just possible in de custom payload.

我希望我的欢迎意图得到音频回应 . 如果不可能,我如何在js中调用欢迎意图?

我的webhook现在:
enter image description here

1 回答

  • 4

    这取决于您的“自定义有效负载”的含义以及您要播放的音频的确切长度,但您可以通过多种方式播放已通过Dialogflow设置配置的音频 . 在某些情况下,您也可以使用类似的方法从PHP播放它 .

    Playing short audio

    您的语音回复可以包括SSML markup,其中可以包含包含音频的 <audio> 标签 . 此音频必须低于120秒 . 所以你可以这样:

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

    在“响应默认”选项卡中,或者在“Google智能助理”选项卡中添加“简单响应” . 在“默认”选项卡中,它看起来像这样:

    enter image description here

    如果您仅对Google智能助理做出回复,则可以通过单击“Google智能助理”标签然后“添加回复”在该标签中执行此操作

    enter image description here

    然后,您可以选择“简单响应”来添加并输入SSML .

    enter image description here

    enter image description here

    Playing longer audio

    如果您的音频超过120秒,则可以向Google智能助理响应添加媒体响应 . 您需要设置一个简单响应,然后单击"Add Responses"添加另一个 .

    enter image description here

    您可能需要向下滚动才能选择“媒体内容” .

    enter image description here

    然后添加内容的信息 . 您至少需要提供将在基于屏幕的设备上显示的名称和音频的URL .

    enter image description here

相关问题