Skip to main content

ConversationHandler

Stentor API Reference


Stentor API Reference / stentor-handler/src / ConversationHandler

Class: ConversationHandler

Defined in: packages/stentor-handler/src/ConversationHandler.ts:11

The most basic implementation of an abstract handler, the conversation handler facilitates basic back and forth, request & response, with users.

Extends​

Constructors​

Constructor​

new ConversationHandler(props): ConversationHandler

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:63

Parameters​

props​

Handler\<Content, Data, Forward, Redirect>

Returns​

ConversationHandler

Inherited from​

AbstractHandler.constructor

Properties​

type​

readonly type: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:37

Inherited from​

AbstractHandler.type


intentId​

readonly intentId: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:39

The ID of the intent, typically a combination of the name and a random string.

Inherited from​

AbstractHandler.intentId


appId​

readonly appId: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:41

The ID for the app the intent belongs to.

Inherited from​

AbstractHandler.appId


organizationId​

readonly organizationId: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:43

The organization ID for the app of which this intent belongs.

Inherited from​

AbstractHandler.organizationId


createdAt​

readonly createdAt: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:45

ISO-8601 string of when the intent was created.

Inherited from​

AbstractHandler.createdAt


content​

readonly content: Content

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:47

Inherited from​

AbstractHandler.content


data​

data: Data

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:49

Inherited from​

AbstractHandler.data


forward​

readonly forward: Forward

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:51

Inherited from​

AbstractHandler.forward


redirect​

readonly redirect: Redirect

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:53

Inherited from​

AbstractHandler.redirect


name?​

readonly optional name: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:55

The human readable name of the intent.

Inherited from​

AbstractHandler.name


slots?​

readonly optional slots: Slot[]

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:57

The slots defined within the utterance patterns and their Entity types.

Inherited from​

AbstractHandler.slots


slotTypes?​

readonly optional slotTypes: SlotTypeMap

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:59

A map of the slot type definition.

Deprecated​

Use Entities

Inherited from​

AbstractHandler.slotTypes


permissions?​

readonly optional permissions: UserDataType[]

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:61

Inherited from​

AbstractHandler.permissions

Methods​

isOwnRequest()​

isOwnRequest(request): boolean

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:86

Determines if the request is for itself.

Parameters​

request​

Request

Returns​

boolean

Inherited from​

AbstractHandler.isOwnRequest


canHandleRequest()​

canHandleRequest(request, context): boolean

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:97

In order to determine if another handler needs to be requested, we need to see if the current handler can handle the request.

Parameters​

request​

Request

context​

Context

Returns​

boolean

Inherited from​

AbstractHandler.canHandleRequest


forwardingPathForRequest()​

forwardingPathForRequest(request, context): Promise\<ExecutablePath>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:126

Get the forwarding path for the provided request.

Returns undefined if a path could not be found.

Parameters​

request​

Request

context​

Context

Returns​

Promise\<ExecutablePath>

Inherited from​

AbstractHandler.forwardingPathForRequest


redirectingPathForRequest()​

redirectingPathForRequest(request, context): Promise\<ExecutablePath>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:139

Check if we have redirects (applied before handling the request). Usually some gate condition.

Returns undefined if a path could not be found.

Parameters​

request​

Request

context​

Context

Returns​

Promise\<ExecutablePath>

Inherited from​

AbstractHandler.redirectingPathForRequest


canHandleInputUnknown()​

canHandleInputUnknown(request, context): boolean

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:151

Can handle InputUnknown

Parameters​

request​

Request

context​

Context

Returns​

boolean

Inherited from​

AbstractHandler.canHandleInputUnknown


repeat()​

protected repeat(request, context): Promise\<void>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:176

Repeats the last uttered response.

Parameters​

request​

Request

context​

Context

Returns​

Promise\<void>

Inherited from​

AbstractHandler.repeat


inputUnknown()​

protected inputUnknown(request, context): Promise\<void>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:197

Handles the situation where the handler

Parameters​

request​

Request

context​

Context

Returns​

Promise\<void>

Inherited from​

AbstractHandler.inputUnknown


start()​

start(request, context): Promise\<void>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:269

Kicks off the handler, typically called when the intent associated with the handler is requested.

Parameters​

request​

Request

context​

Context

Returns​

Promise\<void>

Deprecated​

  • Use handleRequest(), this is now just a wrapper that calls handleRequest()

Inherited from​

AbstractHandler.start


handleRequest()​

handleRequest(request, context): Promise\<void>

Defined in: packages/stentor-handler/src/ConversationHandler.ts:12

Handles the incoming request. Sets the necessary responses and saves the necessary items to storage.

Parameters​

request​

Request

context​

Context

Returns​

Promise\<void>

Overrides​

AbstractHandler.handleRequest