AppResponse

AppResponse 是执行方式向 Google 助理发送的响应。如需查看有关如何在 Actions on Google 中使用此 API 的示例,请参阅 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

一个不透明的令牌,会在每个对话回合中重新循环到 Action。

userStorage

string

由 Action 控制的不透明令牌,可在特定用户的对话之间持久保留。如果为空或未指定,则现有的保留令牌将保持不变。该字符串的最大大小为 10k 字节。如果同一用户同时发生多个对话框,则对此令牌的更新可能会意外地相互覆盖。

resetUserStorage

boolean

是否清除保留的 userStorage。如果设置为 true,则在与用户下次互动时,userStorage 字段将为空。

expectUserResponse

boolean

指明 Action 是否期待用户响应。如果对话正在进行中,则为 true;如果对话完成,则为 false。

expectedInputs[]

object (ExpectedInput)

操作期望的输入列表,每个输入可以是 Google intent 上的常见操作(以“actions.”开头),也可以是接受可能的 intent 列表的输入。目前仅支持一种输入。

finalResponse

object (FinalResponse)

当 Action 不需要用户输入时的最终响应。

customPushMessage

object (CustomPushMessage)

一种自定义推送消息,可让开发者向 Google 上的 Action 发送结构化数据。

isInSandbox

boolean

指示是否应在沙盒模式下处理响应。如需在沙盒模式下将结构化数据推送到 Google,需要此位。

ExpectedInput

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

object (InputPrompt)

用于要求用户输入的自定义提示。

possibleIntents[]

object (ExpectedIntent)

可用于执行此输入的 intent 列表。若要让 Google 上的操作仅返回原始用户输入,应用应请求 actions.intent.TEXT intent。

speechBiasingHints[]

string

Action 希望 Google 用于语音自定义调整的词组列表。最多允许 1000 个词组。

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)

构成响应的界面元素列表。这些项必须满足以下要求:1. 第一项必须是 SimpleResponse 2。最多两个 SimpleResponse 3. 最多一个富响应项(例如 BasicCardStructuredResponseMediaResponseHtmlResponse)4.如果您使用的是 actions.intent.OPTION intent(即 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)

用于在画布上呈现的 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>。与 text_to_speech 相互排斥。

displayText

string

在聊天气泡中显示的可选文本。如果未指定,系统将使用上述 textToSpeech 或 ssml 的显示呈现。上限为 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 世界协调时间(UTC,即“祖鲁时”)格式,精确到纳秒。示例:"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。当状态为 CONFIRMED 或任何其他状态(例如 IN_TRANSIT、FULFILLED)(包括 CONFIRMED 状态)时接收。

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。状态为 CANCELLED 时的取消信息。

JSON 表示法
{
  "reason": string
}
字段
reason

string

取消原因。

InTransitInfo

已弃用:请改用 V3 Proto。状态为 IN_Transit 时的公交信息。

JSON 表示法
{
  "updatedTime": string
}
字段
updatedTime

string (Timestamp format)

运送中时间的上次更新时间。

时间戳采用 RFC3339 世界协调时间(UTC,即“祖鲁时”)格式,精确到纳秒。示例:"2014-10-02T15:01:23.045123456Z"

FulfillmentInfo

已弃用:请改用 V3 Proto。状态为“FULFILLED”时的执行方式信息。

JSON 表示法
{
  "deliveryTime": string
}
字段
deliveryTime

string (Timestamp format)

订单的履单时间。

时间戳采用 RFC3339 世界协调时间(UTC,即“祖鲁时”)格式,精确到纳秒。示例:"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 行一定会显示,但其他行可能会被某些 Surface 裁剪。请使用模拟器进行测试,了解给定界面将会显示哪些行。在支持 WEB_BROWSER 功能的 surface 上,您可以将用户指向包含更多数据的网页。

buttons[]

object (Button)

按钮。目前最多支持 1 个按钮。可选。

ColumnProperties

保留列的属性(包括标题)。

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

string

列的标题文本。

horizontalAlignment

enum (HorizontalAlignment)

内容列的水平对齐方式。如果未指定,内容将与前边缘对齐。

Row

描述表中的行。

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

object (Cell)

此行中的单元格。前 3 个单元格一定会显示,但其他单元格可能在某些表面上被裁剪掉。请使用模拟器进行测试,了解给定界面将会显示哪些单元格。

dividerAfter

boolean

指示每行后面是否应该有一个分隔线。

手机

描述行中的一个单元格。

JSON 表示法
{
  "text": string
}
字段
text

string

单元格的文本内容。

HtmlResponse

使用交互式画布功能显示 HTML 的响应。响应的大小上限为 50k 字节。

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 开发者控制台的操作中验证此应用/网址的所有权,否则系统不会向用户显示建议。“打开网址操作”支持 http、https 和 intent 网址。如需了解 intent 网址,请参阅:https://developer.chrome.com/multidevice/android/intents

ExpectedIntent

应用要求 Google 助理提供的预期 intent。

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

string

内置 intent 名称(例如 actions.intent.TEXT)或 Action 包中定义的 intent。如果指定的 intent 不是内置 intent,则仅用于语音自定义调整,并且 Google 助理提供的输入将是 actions.intent.TEXT intent。

inputValueData

object

内置 intent 所需的其他配置数据。内置 intent 的可能值: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

(可选)正在请求的 intent 的参数。仅对请求的 intent 有效。用于语音自定义调整。

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

包含要针对 Actions 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)

intent 的目标参数。对于 V1 版,仅支持一个参数。

locale

string

要定位的语言区域。遵循 IETF BCP-47 语言代码。可供多语言应用用来针对已本地化的指定应用的用户定位用户。如果未指定,则默认为 en-US。