![](/img/trans.png)
[英]How to add localhost URL in google DialogFlow Webhook?
[英]How to display a Table Card from Dialogflow Webhook in Google Assistant
我已經設置了ASP.NET MVC 4 Web API來處理dialogflow實現。 我的目標是與Google Assistant集成並顯示一張表格卡片作為回應。 我正在通過Google Actions控制台模擬器進行測試。
根據我在這里找到的內容,我已經在GoogleCloudDialogflowV2IntentMessage
Payload
字段中添加了表卡詳細信息:
我的API Webhook的Fulfillment Response最終看起來像這樣:
{
"followupEventInput": {
"languageCode": null,
"name": null,
"parameters": null,
"ETag": null
},
"fulfillmentMessages": [
{
"basicCard": null,
"card": null,
"carouselSelect": null,
"image": null,
"linkOutSuggestion": null,
"listSelect": null,
"payload": {
"google": {
"expectUserResponse": false,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Simple Response TEST",
"ssml": "Simple Response TEST SSML",
"displayText": "Simple Response TEST DISPLAY"
}
},
{
"tableCard": {
"title": "Title",
"subtitle": "Subtitle",
"image": {
"url": "https://www.google.org/static/logo_googledotorg.svg",
"accessibilityText": "Image Accessibility Text TEST"
},
"columnProperties": [
{
"header": "BanksID",
"horizontalAlignment": "LEADING"
},
{
"header": "Name",
"horizontalAlignment": "LEADING"
}
],
"rows": [
{
"cells": [
{
"text": "3"
},
{
"text": "Bank 1 TEST"
}
],
"dividerAfter": false
}
],
"buttons": [
{
"title": "Weblink Title",
"openUrlAction": {
"url": "https://www.google.org",
"urlTypeHint": "URL_TYPE_HINT_UNSPECIFIED"
}
}
]
}
}
]
}
}
},
"platform": null,
"quickReplies": null,
"simpleResponses": {
"simpleResponses": [
{
"displayText": "Simple Response DISPLAY TEST",
"ssml": "Simple Response TEST SSML",
"textToSpeech": "Simple Response TEST",
"ETag": null
}
],
"ETag": null
},
"suggestions": null,
"text": null,
"ETag": null
}
],
"fulfillmentText": "TEST successful.",
"outputContexts": [
{
"lifespanCount": 5,
"name": "banks",
"parameters": {
"TForView": "rra",
"DBVerb": "rra",
"TForView.original": "",
"DBVerb.original": ""
},
"ETag": null
}
],
"payload": null,
"source": null,
"ETag": null
}
問題是我在模擬器中沒有看到桌卡。 我的JSON響應格式可能不正確,因此Google助手無法正確解釋它,但我不知道如何更改它。 我不知道正確的格式是什么。 也許我還缺少其他東西。
如何通過Webhook響應在Google Assistant中顯示表格卡片?
任何幫助/其他想法表示贊賞。
通過查看Dialogflow控制台>診斷信息>履行狀態。
我發現在GoogleCloudDialogflowV2IntentMessage
我同時設置了SimpleResponses
字段和Payload
字段; 和Google助手不太一樣。 因此,我將SimpleResponses
字段設置為null
,然后在Google Actions Simulator上獲得了所需的顯示響應。
SimpleResponses
已經添加到“ Payload
字段中,而Google Assistant並沒有遇到任何麻煩,僅是同時設置了Payload
和SimpleResponses
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.