Google cloud platform Dialogflow webhook中的ssml

Google cloud platform Dialogflow webhook中的ssml,google-cloud-platform,google-cloud-functions,webhooks,dialogflow-es,Google Cloud Platform,Google Cloud Functions,Webhooks,Dialogflow Es,这不是一个重复的问题,我没有得到确切的回答,因此在这里提出了一个新问题。 在webhook响应中写入ssml标记时遇到问题 我之前的webhook回应: {fulfillmentText:“发票金额:测试为$300”}-它在所有界面(如Web、Google助手)上都可以正常工作 现在我想使用ssml,所以我尝试将webhook中的响应更新为 {“语音”:“发票金额:测试为$300”,“显示文本”:“收听语音…” 这在Dialogflow端出错,因为我认为它无法读取响应。 有什么帮助吗 注意:我正

这不是一个重复的问题,我没有得到确切的回答,因此在这里提出了一个新问题。

在webhook响应中写入ssml标记时遇到问题

我之前的webhook回应:

{fulfillmentText:“发票金额:测试为$300”}
-它在所有界面(如Web、Google助手)上都可以正常工作

现在我想使用ssml,所以我尝试将webhook中的响应更新为

{“语音”:“发票金额:测试为$300”,“显示文本”:“收听语音…”

这在Dialogflow端出错,因为我认为它无法读取响应。 有什么帮助吗

注意:我正在使用Google Cloud函数将响应发送回Dialogflow引擎:


res.send(JSON.stringify({'fulfillmentText':output}))

您应该将json中的speech键更改为ssml。 见下例:

{
“有效载荷”:{
“谷歌”:{
“expectUserResponse”:正确,
“richResponse”:{
“项目”:[
{  
“简单响应”:{
“ssml”:"这是SSML示例。我可以暂停。我可以播放声音,你的波形文件。我可以用基数说话。你的位置是10行。或者我可以用序数说话。你是10行。或者我甚至可以用数字说话。你的位置是10行。我还可以替换短语,比如W3C。最后,我可以用两句话来说一段话。这是句子第一句。这是第二句。

“, “displayText”:“这是一个SSML示例。请确保您的声音能够听到演示” } } ] } } } }
?是的,检查过了,但它工作正常吗?应该有一些直接功能,如在Alexa中,您可以直接键入ssml或文本,它将相应地解析响应。
{  
   "payload":{  
      "google":{  
         "expectUserResponse":true,
         "richResponse":{  
            "items":[  
               {  
                  "simpleResponse":{  
                     "ssml":"<speak>Here are <say-as interpret-as=\"characters\">SSML</say-as> samples. I can pause <break time=\"3\" />. I can play a sound <audio src=\"https://actions.google.com/sounds/v1/alarms/winding_alarm_clock.ogg\">your wave file</audio>. I can speak in cardinals. Your position is <say-as interpret-as=\"cardinal\">10</say-as> in line. Or I can speak in ordinals. You are <say-as interpret-as=\"ordinal\">10</say-as> in line. Or I can even speak in digits. Your position in line is <say-as interpret-as=\"digits\">10</say-as>. I can also substitute phrases, like the <sub alias=\"World Wide Web Consortium\">W3C</sub>. Finally, I can speak a paragraph with two sentences. <p><s>This is sentence one.</s><s>This is sentence two.</s></p></speak>",
                     "displayText":"This is a SSML sample. Make sure your sound is enabled to hear the demo"
                  }
               }
            ]
         }
      }
   }
}