Skip to main content

AbstractResponseBuilder

Stentor API Reference


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​

ResponseBuilderProps

Returns​

AbstractResponseBuilder\<R>

Properties​

device​

protected readonly device: 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?​

protected readonly optional backgroundImage: ImageSpecification[]

Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:46

Do not use.

Deprecated​

Use metadata from the App model


assistantTitle?​

protected readonly optional assistantTitle: 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()​

abstract respond(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​

Response

The entire response

Returns​

AbstractResponseBuilder\<R>

The builder instance


say()​

abstract say(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()​

abstract reprompt(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()​

abstract withCard(card): AbstractResponseBuilder\<R>

Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:107

Provide a card

Parameters​

card​

Card

Card to be displayed to the user

Returns​

AbstractResponseBuilder\<R>

The builder instance


withList()​

abstract withList(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()​

abstract withCarousel(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()​

abstract withDisplay(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()​

abstract withSuggestions(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()​

abstract withActiveContext(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()​

abstract withCanFulfill(results): AbstractResponseBuilder\<R>

Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:155

Build intent pre-fetch results aka "CanFulfillRequest"

Parameters​

results​

CanFulfillIntentResult

Returns​

AbstractResponseBuilder\<R>

The builder instance


play()​

abstract play(playable, offset?): AbstractResponseBuilder\<R>

Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:167

Play the provided audio

Parameters​

playable​

PlayableMedia

Media to play

offset?​

number

Returns​

AbstractResponseBuilder\<R>

The builder instance


playPlaylist()​

abstract playPlaylist(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​

PlayableMedia[]

The playlist to be played

Returns​

AbstractResponseBuilder\<R>

The builder instance


stop()​

abstract stop(): AbstractResponseBuilder\<R>

Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:183

Stop the current audio

Returns​

AbstractResponseBuilder\<R>

The builder instance


enqueue()​

abstract enqueue(next, current): AbstractResponseBuilder\<R>

Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:191

Enqueue the next audio

Parameters​

next​

PlayableMedia

Track to be queued

current​

PlayableMedia

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()​

abstract askForAccountLinking(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()​

abstract askForNotification(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()​

abstract askForSurfaceChange(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()​

abstract askForListAccess(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()​

abstract askForUserData(userDataType, accessData?): Promise\<UserDataValue>

Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:239

Chase down the user profile data

Parameters​

userDataType​

UserDataType

accessData?​

ApiAccessData

Returns​

Promise\<UserDataValue>

The builder instance


askForCallTransfer()​

abstract askForCallTransfer(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()​

abstract askForHandoff(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()​

abstract askTransactionRequirements(): AbstractResponseBuilder\<R>

Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:256

Check if the user can "transact"

Returns​

AbstractResponseBuilder\<R>


askForDeliveryAddress()​

abstract askForDeliveryAddress(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()​

abstract askForTransactionDecision(paymentParameters, order): AbstractResponseBuilder\<R>

Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:268

Parameters​

paymentParameters​

PaymentParameters

(google payment or merchant)

order​

OrderDescription

the order description

Returns​

AbstractResponseBuilder\<R>


askForOrderUpdate()​

abstract askForOrderUpdate(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​

OrderDescription

the order description

Returns​

AbstractResponseBuilder\<R>


build()​

abstract build(): R

Defined in: packages/stentor-models/src/Response/AbstractResponseBuilder.ts:280

Build the response

Returns​

R

The built response