ActionSet class

Implement support for named actions which can be bound to a dialog to handle global utterances from the user like "help" or "cancel". Actions get pushed onto and off of the dialog stack as part of dialogs so these listeners can come into and out of scope as the conversation progresses. You can also bind named to actions to buttons which let your bot respond to button clicks on cards that have maybe scrolled off the screen.

Methods

addDialogTrigger(ActionSet, string)

Called once for each dialog within a library to give the dialog a chance to add its triggerAction() to the libraries global action set. These triggers get mapped to a beginDialogAction() that starts the dialog when the trigger condition is met.

clone(ActionSet)

Returns a clone of an existing ActionSet.

findActionRoutes(IRecognizeDialogContext, (err: Error, results: IRouteResult[]) => void)

Called during the Library.findRoutes() call for each dialog on the stack to determine if any of the dialogs actions are triggered by the users utterance.

selectActionRoute(Session, IRouteResult)

Selects the route that had the highest confidence score for the utterance.

Method Details

addDialogTrigger(ActionSet, string)

Called once for each dialog within a library to give the dialog a chance to add its triggerAction() to the libraries global action set. These triggers get mapped to a beginDialogAction() that starts the dialog when the trigger condition is met.

function addDialogTrigger(actions: ActionSet, dialogId: string)

Parameters

actions
ActionSet

Libraries global action set.

dialogId

string

The fully qualified ID of the dialog to trigger.

clone(ActionSet)

Returns a clone of an existing ActionSet.

function clone(copyTo?: ActionSet)

Parameters

copyTo
ActionSet

(Optional) instance to copy the current object to. If missing a new instance will be created.

Returns

findActionRoutes(IRecognizeDialogContext, (err: Error, results: IRouteResult[]) => void)

Called during the Library.findRoutes() call for each dialog on the stack to determine if any of the dialogs actions are triggered by the users utterance.

function findActionRoutes(context: IRecognizeDialogContext, callback: (err: Error, results: IRouteResult[]) => void)

Parameters

context
IRecognizeDialogContext

The context of the incoming message as well as the dialogData for the evaluated dialog.

callback

(err: Error, results: IRouteResult[]) => void

Function to invoke with the top candidate route(s).

selectActionRoute(Session, IRouteResult)

Selects the route that had the highest confidence score for the utterance.

function selectActionRoute(session: Session, route: IRouteResult)

Parameters

session
Session

Session object for the current conversation.

route
IRouteResult

Results returned from the call to findActionRoutes().