Scene

Scene is the basic unit of control flow when designing a conversation. They can be chained together with other scenes, generate prompts for the end user, and define slots. The scene name is specified in the name of the file.

YAML representation
onEnter: 
  object (EventHandler)
intentEvents: 
  - object (IntentEvent)
conditionalEvents: 
  - object (ConditionalEvent)
slots: 
  - object (Slot)
onSlotUpdated: 
  object (EventHandler)
Fields
onEnter

object (EventHandler)

Handler to invoke when transitioning into this scene.

intentEvents[]

object (IntentEvent)

The list of events that trigger based on intents. These events can be triggered at any time after the on_load Handler has been called. Important - these events define the set of intents which are scoped to this scene and will take precedence over any globally defined events that have the same intents or their triggering phrases. Intent names must be unique within a scene.

conditionalEvents[]

object (ConditionalEvent)

The list of events to trigger based on conditional statements. These are evaluated after the form has been filled or immediately after on_load if this scene does not have a form (evaluation is only done once). Only the first matching event will be triggered.

slots[]

object (Slot)

Ordered list of slots. Each slot defines the type of data that it will resolve and configuration to customize the experience of this resolution (e.g. prompts).

onSlotUpdated

object (EventHandler)

Handler called when there is a change in state of a slot not caused by updates within another Handler. This allows slots to be invalidated, the scene invalidated or other changes to scene state.

Slot

Configuration for a slot. Slots are single units of data that can be filled through natural language (ie. intent parameters), session parameters, and other sources.

YAML representation
name: string
type: 
  object (ClassReference)
required: boolean
promptSettings: 
  object (PromptSettings)
commitBehavior: 
  object (CommitBehavior)
config: value
defaultValue: 
  object (DefaultValue)
Fields
name

string

Required. Name of the slot.

type

object (ClassReference)

Required. Declares the data type of this slot.

required

boolean

Optional. Indicates whether the slot is required to be filled before advancing. Required slots that are not filled will trigger a customizable prompt to the user.

promptSettings

object (PromptSettings)

Optional. Registers Prompts for different stages of slot filling.

commitBehavior

object (CommitBehavior)

Optional. Commit behavior associated with the slot.

config

value (Value format)

Optional. Additional configuration associated with the slot which is used for filling the slot. The format of the config is specific to the type of the slot. Resource references to user or session parameter can be added to this config. This config is needed for filling slots related to transactions and user engagement.

Example: For a slot of type actions.type.CompletePurchaseValue, the following config proposes a digital good order with a reference to a client defined session parameter userSelectedSkuId:

{ "@type": "type.googleapis.com/ google.actions.transactions.v3.CompletePurchaseValueSpec", "skuId": { "skuType": "SKU_TYPE_IN_APP", "id": "$session.params.userSelectedSkuId", "packageName": "com.example.company" } }

defaultValue

object (DefaultValue)

Optional. Configuration to populate a default value for this slot.

PromptSettings

A single place where slot prompts are defined.

YAML representation
initialPrompt: 
  object (EventHandler)
noMatchPrompt1: 
  object (EventHandler)
noMatchPrompt2: 
  object (EventHandler)
noMatchFinalPrompt: 
  object (EventHandler)
noInputPrompt1: 
  object (EventHandler)
noInputPrompt2: 
  object (EventHandler)
noInputFinalPrompt: 
  object (EventHandler)
Fields
initialPrompt

object (EventHandler)

Prompt for the slot value itself. Example: "What size did you want?"

noMatchPrompt1

object (EventHandler)

Prompt to give when the user's input does not match the expected value type for the slot for the first time. Example: "Sorry, I didn't get that."

noMatchPrompt2

object (EventHandler)

Prompt to give when the user's input does not match the expected value type for the slot for the second time. Example: "Sorry, I didn't get that."

noMatchFinalPrompt

object (EventHandler)

Prompt to give when the user's input does not match the expected value type for the slot for the last time. Example: "Sorry, I didn't get that."

noInputPrompt1

object (EventHandler)

Prompt to give when the user does not provide an input for the first time. Example: "Sorry, I didn't get that."

noInputPrompt2

object (EventHandler)

Prompt to give when the user does not provide an input for the second time. Example: "Sorry, I didn't get that."

noInputFinalPrompt

object (EventHandler)

Prompt to give when the user does not provide an input for the last time. Example: "Sorry, I didn't get that."

CommitBehavior

Message describing the commit behavior associated with the slot after it has been successfully filled.

YAML representation
writeSessionParam: string
Fields
writeSessionParam

string

The session parameter to write the slot value after it is filled. Note that nested paths are not currently supported. "$$" is used to write the slot value to a session parameter with same name as the slot. Eg: writeSessionParam = "fruit" corresponds to "$session.params.fruit". writeSessionParam = "ticket" corresponds to "$session.params.ticket".

DefaultValue

Configuration to populate a default value for this slot.

YAML representation
sessionParam: string
constant: value
Fields
sessionParam

string

Optional. The session parameter to be used to initialize the slot value, if it has a non-empty value. The type of the value must match the type of the slot. Note that nested paths are not currently supported. Eg: sessionParam = "fruit" corresponds to "$session.params.fruit". sessionParam = "ticket" corresponds to "$session.params.ticket".

constant

value (Value format)

Optional. Constant default value for the slot. This will only be used if a value for this slot was not populated through the sessionParam. The type for this value must match the type of the slot.