AppResponse

AppResponse 是由執行要求傳送給 Google 助理的回應。如需在 Actions on Google 中使用這項功能的範例,請參閱 https://developers.google.com/assistant/df-asdk/reference/conversation-webhook-json#conversation-response-body

JSON 表示法
{
  "conversationToken": string,
  "userStorage": string,
  "resetUserStorage": boolean,
  "expectUserResponse": boolean,
  "expectedInputs": [
    {
      object (ExpectedInput)
    }
  ],
  "finalResponse": {
    object (FinalResponse)
  },
  "customPushMessage": {
    object (CustomPushMessage)
  },
  "isInSandbox": boolean
}
欄位
conversationToken

string

不透明的權杖,會在每次對話各回合時循環播放。

userStorage

string

由動作控管的不透明權杖,會在特定使用者的對話中持續存在。如果留空或未指定,現有的保留權杖將維持不變。字串大小上限為 10,000 個位元組。如果同一位使用者同時發生多個對話方塊,則更新這組權杖時,可能會以非預期的方式覆寫彼此。

resetUserStorage

boolean

是否要清除保留的 userStorage。如果設為 true,使用者下一次與使用者互動時,userStorage 欄位就會留空。

expectUserResponse

boolean

表示動作是否預期使用者會回應。如果對話仍在進行中,系統便會顯示該訊息,對話結束後則為「否」。

expectedInputs[]

object (ExpectedInput)

動作預期的輸入內容清單、每個輸入內容都是 Google 意圖上的常用動作 (以「actions.」),或是可能意圖的輸入清單。目前僅支援一個輸入來源。

finalResponse

object (FinalResponse)

動作未預期使用者輸入內容時的最終回應。

customPushMessage

object (CustomPushMessage)

自訂推送訊息,可讓開發人員將結構化資料傳送至 Google 上的動作。

isInSandbox

boolean

指出是否應在沙箱模式中處理回應。如要在沙箱模式中將結構化資料推送至 Google,您必須取得這個位元。

ExpectedInput

JSON 表示法
{
  "inputPrompt": {
    object (InputPrompt)
  },
  "possibleIntents": [
    {
      object (ExpectedIntent)
    }
  ],
  "speechBiasingHints": [
    string
  ]
}
欄位
inputPrompt

object (InputPrompt)

用來要求使用者輸入內容的自訂提示。

possibleIntents[]

object (ExpectedIntent)

可用於執行這項輸入內容的意圖清單。如要讓 Google 上的動作只傳回原始使用者輸入內容,應用程式應要求 actions.intent.TEXT 意圖。

speechBiasingHints[]

string

動作希望 Google 用於語音自訂調整的詞組清單。最多可以使用 1,000 個詞組。

InputPrompt

Google 助理使用的輸入提示,用來引導使用者輸入應用程式的問題。

JSON 表示法
{
  "initialPrompts": [
    {
      object (SpeechResponse)
    }
  ],
  "richInitialPrompt": {
    object (RichResponse)
  },
  "noInputPrompts": [
    {
      object (SimpleResponse)
    }
  ]
}
欄位
initialPrompts[]
(deprecated)

object (SpeechResponse)

提示使用者輸入內容的初始提示。僅支援一個 initial_prompt。

richInitialPrompt

object (RichResponse)

提示酬載。

noInputPrompts[]

object (SimpleResponse)

在使用者未提供輸入內容時,系統會使用提示詢問使用者。

SpeechResponse

僅包含語音的回應。已淘汰。

JSON 表示法
{

  // Union field type can be only one of the following:
  "textToSpeech": string,
  "ssml": string
  // End of list of possible types for union field type.
}
欄位
聯集欄位 type。語音輸出類型:文字轉語音或 SSML。type 只能是下列其中一項:
textToSpeech

string

語音輸出的純文字,例如"您想去哪裡?"/

ssml

string

向使用者顯示結構化的語音回應,採用 SSML 格式,例如:「 請在發音後說出動物名稱。」。與 textToSpeech 互斥。

RichResponse

這類回應內容可包含音訊、文字、資訊卡、建議和結構化資料。

JSON 表示法
{
  "items": [
    {
      object (Item)
    }
  ],
  "suggestions": [
    {
      object (Suggestion)
    }
  ],
  "linkOutSuggestion": {
    object (LinkOutSuggestion)
  }
}
欄位
items[]

object (Item)

組成回應的 UI 元素清單。項目必須符合下列要求:1. 第一個項目必須是 SimpleResponse 2。最多兩個 SimpleResponse 3. 最多一個複合式回應項目 (例如 BasicCardStructuredResponseMediaResponseHtmlResponse) 4.如果您目前使用 actions.intent.OPTION 意圖 (包含 ListSelectCarouselSelect),就無法使用複合式回應項目

suggestions[]

object (Suggestion)

建議回覆清單。這些內容一律會顯示在回應結尾。在 FinalResponse 中使用系統會忽略這些項目。

項目

回覆項目。

JSON 表示法
{
  "name": string,

  // Union field item can be only one of the following:
  "simpleResponse": {
    object (SimpleResponse)
  },
  "basicCard": {
    object (BasicCard)
  },
  "structuredResponse": {
    object (StructuredResponse)
  },
  "mediaResponse": {
    object (MediaResponse)
  },
  "carouselBrowse": {
    object (CarouselBrowse)
  },
  "tableCard": {
    object (TableCard)
  },
  "htmlResponse": {
    object (HtmlResponse)
  }
  // End of list of possible types for union field item.
}
欄位
name

string

此商品的選用命名識別碼。

聯集欄位 item。項目類型。item 只能是下列其中一項:
simpleResponse

object (SimpleResponse)

語音和純文字回應。

basicCard

object (BasicCard)

基本資訊卡。

structuredResponse

object (StructuredResponse)

Google 要處理的結構化酬載。

mediaResponse

object (MediaResponse)

回應指出要播放的媒體組合。

carouselBrowse

object (CarouselBrowse)

輪轉介面瀏覽資訊卡,請改用 collectionBrowse。

tableCard

object (TableCard)

表格資訊卡。

htmlResponse

object (HtmlResponse)

用於在 Canvas 上算繪的 HTML 回應。

SimpleResponse

內含語音或文字的簡單回應,可向使用者顯示。

JSON 表示法
{
  "textToSpeech": string,
  "ssml": string,
  "displayText": string
}
欄位
textToSpeech

string

語音輸出的純文字,例如「你想要去哪裡?」與 ssml 互斥。

ssml

string

向使用者發出的結構化語音回應,採用 SSML 格式,例如 <speak> Say animal name after the sound. <audio src = 'https://www.pullstring.com/moo.mps' />, what’s the animal? </speak>。與 textToSpeech 互斥。

displayText

string

顯示在即時通訊泡泡中的選填文字。如未指定,系統會使用上述的 textToSpeech 或 sml 顯示畫面。最長不得超過 640 個半形字元。

BasicCard

顯示部分資訊的基本資訊卡,例如圖片和/或文字。

JSON 表示法
{
  "title": string,
  "subtitle": string,
  "formattedText": string,
  "image": {
    object (Image)
  },
  "buttons": [
    {
      object (Button)
    }
  ],
  "imageDisplayOptions": enum (ImageDisplayOptions)
}
欄位
title

string

資訊卡的總標題。選用。

subtitle

string

選用。

formattedText

string

資訊卡的內文。支援有限的 Markdown 語法組合。除非有圖片,否則此為必要項目。

image

object (Image)

資訊卡的主頁橫幅。高度固定為 192dp。選用。

buttons[]

object (Button)

按鈕。目前最多支援 1 個按鈕。選用。

imageDisplayOptions

enum (ImageDisplayOptions)

圖片顯示選項的類型選用。

按鈕

通常顯示在資訊卡底部的按鈕物件。

JSON 表示法
{
  "title": string,
  "openUrlAction": {
    object (OpenUrlAction)
  }
}
欄位
title

string

按鈕的標題這是必填欄位。

openUrlAction

object (OpenUrlAction)

使用者輕觸按鈕時要執行的動作。這是必填欄位。

StructuredResponse

為應用程式定義以結構化資料回應的回應。

JSON 表示法
{

  // Union field data can be only one of the following:
  "orderUpdate": {
    object (OrderUpdate)
  },
  "orderUpdateV3": {
    object (OrderUpdate)
  }
  // End of list of possible types for union field data.
}
欄位
聯集欄位 data。第三方代理程式酬載回應的容器。data 只能是下列其中一項:
orderUpdate

object (OrderUpdate)

應用程式會在收到訂單後提供訂單更新 (例如 Receipt)。

orderUpdateV3

object (OrderUpdate)

應用程式在收到訂單後,以 API v3 格式提供訂單更新。

OrderUpdate

已淘汰:請改用 V3 Proto。更新訂單。

JSON 表示法
{
  "googleOrderId": string,
  "actionOrderId": string,
  "orderState": {
    object (OrderState)
  },
  "orderManagementActions": [
    {
      object (Action)
    }
  ],
  "receipt": {
    object (Receipt)
  },
  "updateTime": string,
  "totalPrice": {
    object (Price)
  },
  "lineItemUpdates": {
    string: {
      object(LineItemUpdate)
    },
    ...
  },
  "userNotification": {
    object (UserNotification)
  },
  "infoExtension": {
    "@type": string,
    field1: ...,
    ...
  },

  // Union field info can be only one of the following:
  "rejectionInfo": {
    object (RejectionInfo)
  },
  "cancellationInfo": {
    object (CancellationInfo)
  },
  "inTransitInfo": {
    object (InTransitInfo)
  },
  "fulfillmentInfo": {
    object (FulfillmentInfo)
  },
  "returnInfo": {
    object (ReturnInfo)
  }
  // End of list of possible types for union field info.
}
欄位
googleOrderId

string

訂單 ID 是 Google 核發的 ID。

actionOrderId

string

必要欄位。參照這筆訂單的標準訂單 ID。如果整合商不會在系統中產生標準訂單 ID,只要複製其中的 googleOrderId 即可。

orderState

object (OrderState)

訂單的新狀態。

orderManagementActions[]

object (Action)

更新訂單的適用管理動作,例如管理、修改、與支援團隊聯絡。

receipt

object (Receipt)

訂單收據。

updateTime

string (Timestamp format)

從應用程式的角度更新訂單的時間。

RFC3339 世界標準時間「Zulu」格式的時間戳記,精確度達奈秒單位,範例:"2014-10-02T15:01:23.045123456Z"

totalPrice

object (Price)

新的訂單總價

lineItemUpdates

map (key: string, value: object (LineItemUpdate))

委刊項層級異動的對應圖,以項目 ID 做為鍵。選用。

這個物件中包含 "key": value 組合的清單,例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }.

userNotification

object (UserNotification)

如果有指定,系統會向使用者顯示指定標題和文字的通知。指定通知是建議通知,不保證一定會收到通知。

infoExtension

object

自訂訂單狀態或標準狀態相關資訊的額外資料。

包含任意類型欄位的物件。額外的 "@type" 欄位則包含能辨識類型的 URI。例如:{ "id": 1234, "@type": "types.example.com/standard/id" }.

聯集欄位 info。與訂單狀態相關的其他資訊。info 只能是下列其中一項:
rejectionInfo

object (RejectionInfo)

拒絕狀態的相關資訊。

cancellationInfo

object (CancellationInfo)

取消狀態的相關資訊。

inTransitInfo

object (InTransitInfo)

傳輸狀態的相關資訊。

fulfillmentInfo

object (FulfillmentInfo)

執行要求狀態的相關資訊。

returnInfo

object (ReturnInfo)

傳回狀態的相關資訊。

動作

與訂單更新相關的後續動作。

JSON 表示法
{
  "type": enum (ActionType),
  "button": {
    object (Button)
  }
}
欄位
type

enum (ActionType)

動作類型。

button

object (Button)

按鈕標籤和連結。

收據

已淘汰:請改用 V3 Proto。狀態為「已確認」或任何其他狀態 (例如 IN_TRANSIT、FULFILLED) 且包含「確認」狀態時會收到的收據。

JSON 表示法
{
  "confirmedActionOrderId": string,
  "userVisibleOrderId": string
}
欄位
confirmedActionOrderId
(deprecated)

string

已在整合商收到訂單時確認訂單 ID。這是整合商系統中參照訂單的標準訂單 ID,之後可能會用來識別訂單為 actionOrderId

請注意,這個欄位已淘汰。請改為透過 OrderUpdate.action_order_id 傳遞欄位。

userVisibleOrderId

string

選用設定。使用者專屬 ID,參照目前訂單,且會顯示在收據卡上 (如有)。這個 ID 通常會顯示在使用者電子郵件收到的紙本收據或收據上。使用者應能使用這個 ID,參照整合商提供的客戶服務訂單。請注意,如果整合商要針對印有收據 / 電子郵件收據的訂單產生使用者專屬 ID,則必須填寫這個欄位。

RejectionInfo

狀態是 REJECTED 時的拒絕資訊。您可以在對話中的初始訂單更新,或後續的非同步訂單更新時填入這則訊息。

JSON 表示法
{
  "type": enum (ReasonType),
  "reason": string
}
欄位
type

enum (ReasonType)

拒絕類型。

reason

string

錯誤原因。

CancellationInfo

已淘汰:請改用 V3 Proto。狀態為「已取消」時的取消資訊。

JSON 表示法
{
  "reason": string
}
欄位
reason

string

取消原因。

InTransitInfo

已淘汰:請改用 V3 Proto。州為 IN_TRANSIT 時的運輸資訊。

JSON 表示法
{
  "updatedTime": string
}
欄位
updatedTime

string (Timestamp format)

大眾運輸的上次更新時間。

RFC3339 世界標準時間「Zulu」格式的時間戳記,精確度達奈秒單位,範例:"2014-10-02T15:01:23.045123456Z"

FulfillmentInfo

已淘汰:請改用 V3 Proto。狀態為「FULFILLED」時的執行要求資訊。

JSON 表示法
{
  "deliveryTime": string
}
欄位
deliveryTime

string (Timestamp format)

訂單出貨時間。

RFC3339 世界標準時間「Zulu」格式的時間戳記,精確度達奈秒單位,範例:"2014-10-02T15:01:23.045123456Z"

ReturnInfo

已淘汰:請改用 V3 Proto。狀態是 REJECTED 時的傳回資訊。

JSON 表示法
{
  "reason": string
}
欄位
reason

string

退貨原因。

UserNotification

選填的使用者通知,會顯示在訂單更新中。

JSON 表示法
{
  "title": string,
  "text": string
}
欄位
title

string

使用者通知的標題。

text

string

通知的內容。

MediaResponse

回應表示要在對話中播放的一組媒體。

JSON 表示法
{
  "mediaType": enum (MediaType),
  "mediaObjects": [
    {
      object (MediaObject)
    }
  ]
}
欄位
mediaType

enum (MediaType)

此回應中的媒體類型

mediaObjects[]

object (MediaObject)

媒體物件清單。

MediaObject

代表一個與 MediaResponse 傳回的媒體物件。包含媒體相關資訊,例如名稱、說明、網址等。

JSON 表示法
{
  "name": string,
  "description": string,
  "contentUrl": string,

  // Union field image can be only one of the following:
  "largeImage": {
    object (Image)
  },
  "icon": {
    object (Image)
  }
  // End of list of possible types for union field image.
}
欄位
name

string

這個媒體物件的名稱

description

string

此媒體物件的說明。

contentUrl

string

指向媒體內容的網址。

聯集欄位 image。與媒體資訊卡一起顯示的圖片。image 只能是下列其中一項:
largeImage

object (Image)

大型圖片,例如相簿封面等。

icon

object (Image)

顯示在標題右側的小型圖片圖示。大小已調整為 36x36 dp。

CarouselBrowse

將一組 AMP 文件顯示為大型圖塊項目的輪轉介面。您可以選取項目,在 AMP 檢視器中啟動相關聯的 AMP 文件。

JSON 表示法
{
  "items": [
    {
      object (Item)
    }
  ],
  "imageDisplayOptions": enum (ImageDisplayOptions)
}
欄位
items[]

object (Item)

最小值:2. 最大值:10。

imageDisplayOptions

enum (ImageDisplayOptions)

圖片顯示選項的類型選用。

項目

輪轉介面中的項目。

JSON 表示法
{
  "title": string,
  "description": string,
  "footer": string,
  "image": {
    object (Image)
  },
  "openUrlAction": {
    object (OpenUrlAction)
  }
}
欄位
title

string

輪轉介面項目的標題。這是必填欄位。

description

string

輪轉介面項目的說明。選用。

footer

string

輪轉介面項目的頁尾文字,顯示在說明下方。單行文字,以刪節號截斷。選用。

image

object (Image)

輪轉介面項目的主頁橫幅。選用。

openUrlAction

object (OpenUrlAction)

與輪轉介面項目相關聯的文件網址。文件可以包含 HTML 內容;如果「urlTypeHint」設為 AMP_CONTENT,也就是 AMP 內容。這是必填欄位。

TableCard

顯示文字表格的表格資訊卡。

JSON 表示法
{
  "title": string,
  "subtitle": string,
  "image": {
    object (Image)
  },
  "columnProperties": [
    {
      object (ColumnProperties)
    }
  ],
  "rows": [
    {
      object (Row)
    }
  ],
  "buttons": [
    {
      object (Button)
    }
  ]
}
欄位
title

string

表格的整體標題。選用;如果設定字幕,則必須設定此項目。

subtitle

string

資料表的副標題。選用。

image

object (Image)

與表格相關聯的圖片。選用。

columnProperties[]

object (ColumnProperties)

資料欄的標頭和對齊方式。

rows[]

object (Row)

資料表的資料列資料。前 3 列一定會顯示,但其他內容可能會在特定介面上顯示。請使用模擬工具進行測試,瞭解特定介面會顯示哪些資料列。在支援 WEB_BROWSER 功能的介面上,您可以將使用者導向含有更多資料的網頁。

buttons[]

object (Button)

按鈕。目前最多支援 1 個按鈕。選用。

ColumnProperties

保留欄屬性 (包括標頭)。

JSON 表示法
{
  "header": string,
  "horizontalAlignment": enum (HorizontalAlignment)
}
欄位
header

string

資料欄的標題文字。

horizontalAlignment

enum (HorizontalAlignment)

內容 w.r.t 欄的水平對齊。如未指定,內容則會與頂部邊緣對齊。

Row

說明資料表中的資料列。

JSON 表示法
{
  "cells": [
    {
      object (Cell)
    }
  ],
  "dividerAfter": boolean
}
欄位
cells[]

object (Cell)

此列的儲存格。我們保證顯示前 3 個儲存格,但其他儲存格可能會截斷。請使用模擬器進行測試,看看在特定表面會顯示哪些儲存格。

dividerAfter

boolean

指出每一列後是否應有分隔線。

行動電話

說明資料列中的儲存格。

JSON 表示法
{
  "text": string
}
欄位
text

string

儲存格的文字內容。

HtmlResponse

使用互動式畫布功能顯示 HTML 的回應。回應的大小上限為 50,000 個位元組。

JSON 表示法
{
  "updatedState": value,
  "suppressMic": boolean,
  "url": string
}
欄位
updatedState

value (Value format)

將下列 JSON 物件傳送給應用程式。

suppressMic

boolean

提供相應選項,讓系統在收到這則沉浸式回應後開啟麥克風。

url

string

應用程式的網址。

建議

使用者輕觸的建議方塊,即可快速張貼對話回覆。

JSON 表示法
{
  "title": string
}
欄位
title

string

建議方塊中顯示的文字。使用者輕觸這段文字後,系統會將其內容張貼回對話,就像使用者輸入內容一樣。所有標題在一組建議方塊中都不得重複。必須提供最多 25 個半形字元

LinkOutSuggestion

建立建議方塊,讓使用者跳至與這個代理程式相關的應用程式或網站。

JSON 表示法
{
  "destinationName": string,
  "url": string,
  "openUrlAction": {
    object (OpenUrlAction)
  }
}
欄位
destinationName

string

這個方塊連結的應用程式或網站名稱。這個方塊會顯示為「開啟」標題,最多 20 個字元。這是必要項目。

url
(deprecated)

string

已淘汰,請改用 OpenUrlAction。

openUrlAction

object (OpenUrlAction)

使用者輕觸建議方塊時要開啟的應用程式或網站網址。這個應用程式/網址的擁有權必須透過 Google Developers Console 的相關動作驗證,否則使用者不會看到建議。開啟網址動作支援 http、https 和意圖網址。意圖網址請參閱:https://developer.chrome.com/multidevice/android/intents

ExpectedIntent

應用程式要求 Google 助理提供的預期意圖。

JSON 表示法
{
  "intent": string,
  "inputValueData": {
    "@type": string,
    field1: ...,
    ...
  },
  "parameterName": string
}
欄位
intent

string

內建意圖名稱,例如 actions.intent.TEXT,或動作套件中定義的意圖。如果指定的意圖不是內建意圖,只會用於語音自訂調整,而 Google 助理提供的輸入內容將為 actions.intent.TEXT 意圖。

inputValueData

object

內建意圖需要的其他設定資料。內建意圖可能的值:actions.intent.OPTION -> google.actions.v2.OptionValueSpecactions.intent.CONFIRMATION -> google.actions.v2.ConfirmationValueSpecactions.intent.TRANSACTION_REQUIREMENTS_CHECK -> google.actions.v2.TransactionRequirementsCheckSpecactions.intent.DELIVERY_ADDRESS -> google.actions.v2.DeliveryAddressValueSpecactions.intent.TRANSACTION_DECISION -> google.actions.v2.TransactionDecisionValueSpecactions.intent.PLACE -> google.actions.v2.PlaceValueSpecactions.intent.Link -> google.actions.v2.LinkValueSpec

包含任意類型欄位的物件。額外的 "@type" 欄位則包含能辨識類型的 URI。例如:{ "id": 1234, "@type": "types.example.com/standard/id" }.

parameterName

string

(選用) 所要求意圖的參數。僅適用於要求的意圖。用於語音自訂調整。

FinalResponse

未預期使用者輸入內容時的最終回應。

JSON 表示法
{

  // Union field response can be only one of the following:
  "speechResponse": {
    object (SpeechResponse)
  },
  "richResponse": {
    object (RichResponse)
  }
  // End of list of possible types for union field response.
}
欄位
聯集欄位 response。可能的回應類型。response 只能是下列其中一項:
speechResponse
(deprecated)

object (SpeechResponse)

使用者不需要輸入內容時,語音回應。

richResponse

object (RichResponse)

使用者不需要輸入內容時,系統提供豐富的回應。

CustomPushMessage

自訂推送訊息,包含動作 Fulfillment API 所推送的結構化資料。

JSON 表示法
{
  "target": {
    object (Target)
  },

  // Union field content can be only one of the following:
  "orderUpdate": {
    object (OrderUpdate)
  },
  "userNotification": {
    object (UserNotification)
  }
  // End of list of possible types for union field content.
}
欄位
target

object (Target)

推送要求的指定目標。

聯集欄位 content。不同類型的酬載。content 只能是下列其中一項:
orderUpdate

object (OrderUpdate)

更新透過交易 API 提交的訂單更新訂單。

userNotification

object (UserNotification)

如果有指定,系統會向使用者顯示含有指定標題和文字的通知。

UserNotification

顯示要求的使用者通知。

JSON 表示法
{
  "title": string,
  "text": string
}
欄位
title

string

通知的標題。

text

string

通知的內容。

目標

推送要求的指定目標。

JSON 表示法
{
  "userId": string,
  "intent": string,
  "argument": {
    object (Argument)
  },
  "locale": string
}
欄位
userId

string

要指定的使用者。

intent

string

要指定的意圖。

argument

object (Argument)

意圖指定的引數。V1 只支援一個引數。

locale

string

要指定的語言代碼。遵循 IETF BCP-47 語言代碼。適用於多語言應用程式,可以鎖定特定本地化應用程式的使用者。如未指定,則預設為 en-US。