AbstractResponseBuilder
Stentor API Reference / stentor-models/src / AbstractResponseBuilder
Abstract Class: AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:33
Type Parametersβ
Rβ
R = any
Constructorsβ
Constructorβ
new AbstractResponseBuilder\<
R>(props):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:71
Parametersβ
propsβ
Returnsβ
AbstractResponseBuilder\<R>
Propertiesβ
deviceβ
protectedreadonlydevice:Readonly\<Device>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:40
Information about the device capabilities. Use to determine if you can present display information or play media.
backgroundImage?β
protectedreadonlyoptionalbackgroundImage:ImageSpecification[]
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:46
Do not use.
Deprecatedβ
Use metadata from the App model
assistantTitle?β
protectedreadonlyoptionalassistantTitle:string
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:52
Do not use.
Deprecatedβ
Use metadata from the App model
tagβ
tag:
string|string[]
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:69
Tag used by supported 3rd party analytics to track the response.
Accessorsβ
responseβ
Get Signatureβ
get response():
Readonly\<Response\<ResponseOutput>>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:58
The response that will be communicated to the user
Returnsβ
Readonly\<Response\<ResponseOutput>>
Methodsβ
respond()β
abstractrespond(response):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:84
Respond to the user.
Can contain just an output speech but can also contain an reprompt.
Parametersβ
responseβ
The entire response
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
say()β
abstractsay(ssml,append?):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:92
Say something to the user.
Parametersβ
ssmlβ
The response, either as a string or a response output object which contains SSML and display text.
string | ResponseOutput
append?β
boolean
Append the response to the existing, if available
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
reprompt()β
abstractreprompt(ssml,append?):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:100
Provide a reprompt, necessary if you want to "ask" something
Parametersβ
ssmlβ
The reprompt, either as a string or a response output object which contains SSML and display text.
string | ResponseOutput
append?β
boolean
Append the response to the existing, if available
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
withCard()β
abstractwithCard(card):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:107
Provide a card
Parametersβ
cardβ
Card to be displayed to the user
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
withList()β
abstractwithList(items,title?):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:115
Provide a list (vertical selection)
Parametersβ
itemsβ
ListItem[]
List items to display
title?β
string
The title for the list
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
withCarousel()β
abstractwithCarousel(items):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:122
Provide a carousel (horizontal selection)
Parametersβ
itemsβ
ListItem[]
List items to display in the carousel
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
withDisplay()β
abstractwithDisplay(display):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:129
Add a custom display object to the response
Parametersβ
displayβ
object
A custom display object
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
withSuggestions()β
abstractwithSuggestions(suggestion,append?):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:138
Provide suggestions for the user.
Limited support across platforms for this at the moment, only Google Assistant.
Parametersβ
suggestionβ
Either a single suggestion chip or an array
SuggestionTypes | SuggestionTypes[]
append?β
boolean
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
withActiveContext()β
abstractwithActiveContext(context):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:148
Active contexts provide guidance to the NLU to help it better select the next intent from the user's utterance.
Parametersβ
contextβ
Either a single context or array of contexts.
ActiveContext | ActiveContext[]
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
withCanFulfill()β
abstractwithCanFulfill(results):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:155
Build intent pre-fetch results aka "CanFulfillRequest"
Parametersβ
resultsβ
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
play()β
abstractplay(playable,offset?):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:167
Play the provided audio
Parametersβ
playableβ
Media to play
offset?β
number
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
playPlaylist()β
abstractplayPlaylist(playlist):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:177
Play a playlist
Note: Only supported by Actions on Google at the moment. If attempting to use this function on Alexa, only the first item in the playlist will be played.
Parametersβ
playlistβ
The playlist to be played
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
stop()β
abstractstop():AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:183
Stop the current audio
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
enqueue()β
abstractenqueue(next,current):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:191
Enqueue the next audio
Parametersβ
nextβ
Track to be queued
currentβ
The current track playing
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
mediaQueueSize()β
mediaQueueSize():
number
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:195
The number of playables that can be sent at once. Override it if the platform handles more.
Returnsβ
number
askForAccountLinking()β
abstractaskForAccountLinking(response?):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:208
Request account linking
Parametersβ
response?β
string | SimpleResponse\<string | ResponseOutput>
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
askForNotification()β
abstractaskForNotification(intentId?):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:216
Beta
Request notification to intent
This is a beta feature.
Parametersβ
intentId?β
string
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
askForSurfaceChange()β
abstractaskForSurfaceChange(response?,notificationLabel?):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:224
Ask the user to change surfaces, for example from a smart speaker to a mobile phone.
Parametersβ
response?β
Response to give as context to the user for the surface change
string | SimpleResponse\<string | ResponseOutput>
notificationLabel?β
string
The label for the notification on the new surface
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
askForListAccess()β
abstractaskForListAccess(response?):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:233
Request access to shopping lists
Parametersβ
response?β
string | SimpleResponse\<string | ResponseOutput>
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
askForUserData()β
abstractaskForUserData(userDataType,accessData?):Promise\<UserDataValue>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:239
Chase down the user profile data
Parametersβ
userDataTypeβ
accessData?β
Returnsβ
Promise\<UserDataValue>
The builder instance
askForCallTransfer()β
abstractaskForCallTransfer(phoneNumber):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:246
Ask for call transfer (on telephony capable channels)
Parametersβ
phoneNumberβ
string
The phone number to transfer the call to
Returnsβ
AbstractResponseBuilder\<R>
The builder instance
askForHandoff()β
abstractaskForHandoff(handoffTargetId):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:252
Alpha
- The feature is under active development
Parametersβ
handoffTargetIdβ
string
The id that represents the handoff target (app id/name, queue id/name, etc)
Returnsβ
AbstractResponseBuilder\<R>
askTransactionRequirements()β
abstractaskTransactionRequirements():AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:256
Check if the user can "transact"
Returnsβ
AbstractResponseBuilder\<R>
askForDeliveryAddress()β
abstractaskForDeliveryAddress(response?):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:262
Ask the platform to query the delivery address
Parametersβ
response?β
The reason for the delivery address ("To know where to send the order")
string | SimpleResponse\<string | ResponseOutput>
Returnsβ
AbstractResponseBuilder\<R>
askForTransactionDecision()β
abstractaskForTransactionDecision(paymentParameters,order):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:268
Parametersβ
paymentParametersβ
(google payment or merchant)
orderβ
the order description
Returnsβ
AbstractResponseBuilder\<R>
askForOrderUpdate()β
abstractaskForOrderUpdate(response,order):AbstractResponseBuilder\<R>
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:274
Parametersβ
responseβ
To announce the order was completed ("Your order ${conv.data.UNIQUE_ORDER_ID} is all set!")
string | SimpleResponse\<string | ResponseOutput>
orderβ
the order description
Returnsβ
AbstractResponseBuilder\<R>
build()β
abstractbuild():R
Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:280
Build the response
Returnsβ
R
The built response