Options
All
  • Public
  • Public/Protected
  • All
Menu

Class IntentDialog

Identifies a users intent and optionally extracts entities from a users utterance.

Hierarchy

Index

Constructors

constructor

Methods

addDialogTrigger

  • addDialogTrigger(actions: ActionSet, dialogId: string): void
  • 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.

    Parameters

    • actions: ActionSet

      Libraries global action set.

    • dialogId: string

      The fully qualified ID of the dialog to trigger.

    Returns void

begin

  • begin<T>(session: Session, args?: T): void
  • Called when a new dialog session is being started.

    Type parameters

    • T

    Parameters

    • session: Session

      Session object for the current conversation.

    • Optional args: T

      (Optional) arguments passed to the dialog by its parent.

    Returns void

beginDialogAction

  • Binds an action to the dialog that will start another dialog anytime its triggered. The new dialog will be pushed onto the stack so it does not automatically end the current task. The current task will be continued once the new dialog ends. The built-in prompts will automatically re-prompt the user once this happens but that behaviour can be disabled by setting the promptAfterAction flag when calling a built-in prompt.

    Parameters

    • name: string

      Unique name to assign the action.

    • id: string

      ID of the dialog to start.

    • Optional options: IBeginDialogActionOptions

      (Optional) options used to configure the action. If matches is specified the action will listen for the user to say a word or phrase that triggers the action, otherwise the action needs to be bound to a button using CardAction.dialogAction() to trigger the action. You can also use dialogArgs to pass additional params to the dialog being started.

    Returns Dialog

cancelAction

  • Binds an action to the dialog that will cancel the dialog anytime its triggered. When canceled, the dialogs parent will be resumed with a resumed code indicating that it was canceled.

    Parameters

    • name: string

      Unique name to assign the action.

    • Optional msg: string | string[] | IMessage | IIsMessage

      (Optional) message to send the user prior to canceling the dialog.

    • Optional options: ICancelActionOptions

      (Optional) options used to configure the action. If matches is specified the action will listen for the user to say a word or phrase that triggers the action, otherwise the action needs to be bound to a button using CardAction.dialogAction() to trigger the action.

    Returns Dialog

clone

dialogInterrupted

  • dialogInterrupted(session: Session, dialogId: string, dialogArgs: any): void
  • Called when a root dialog is being interrupted by another dialog. This gives the dialog that's being interrupted a chance to run custom logic before it's removed from the stack.

    The dialog itself is responsible for clearing the dialog stack and starting the new dialog.

    Parameters

    • session: Session

      Session object for the current conversation.

    • dialogId: string

      ID of the dialog that should be started.

    • dialogArgs: any

      Arguments that should be passed to the new dialog.

    Returns void

dialogResumed

  • A child dialog has ended and the current one is being resumed.

    Type parameters

    • T

    Parameters

    • session: Session

      Session object for the current conversation.

    • result: IDialogResult<T>

      Result returned by the child dialog.

    Returns void

endConversationAction

  • Binds an action that will end the conversation with the user when triggered.

    Parameters

    • name: string

      Unique name to assign the action.

    • Optional msg: string | string[] | IMessage | IIsMessage

      (Optional) message to send the user prior to ending the conversation.

    • Optional options: ICancelActionOptions

      (Optional) options used to configure the action. If matches is specified the action will listen for the user to say a word or phrase that triggers the action, otherwise the action needs to be bound to a button using CardAction.dialogAction() to trigger the action.

    Returns Dialog

findActionRoutes

matches

  • Invokes a handler when a given intent is detected in the users utterance.

    NOTE: The full details of the match, including the list of intents & entities detected, will be passed to the args of the first waterfall step or dialog that's started.

    Parameters

    • intent: RegExp | string
      • intent: {RegExp} - A regular expression that will be evaluated to detect the users intent.
      • intent: {string} - A named intent returned by an IIntentRecognizer plugin that will be used to match the users intent.
    • dialogId: string | IDialogWaterfallStep[] | IDialogWaterfallStep
      • dialogId: _{string} - The ID of a dialog to begin when the intent is matched.
      • dialogId: {IDialogWaterfallStep[]} - Waterfall of steps to execute when the intent is matched.
      • dialogId: {IDialogWaterfallStep} - Single step waterfall to execute when the intent is matched. Calling a built-in prompt or starting a new dialog will result in the current dialog ending upon completion of the child prompt/dialog.
    • Optional dialogArgs: any

      (Optional) arguments to pass the dialog that started when dialogId is a {string}.

    Returns IntentDialog

matchesAny

  • Invokes a handler when any of the given intents are detected in the users utterance.

    NOTE: The full details of the match, including the list of intents & entities detected, will be passed to the args of the first waterfall step or dialog that's started.

    Parameters

    • intent: RegExp[] | string[]
      • intent: {RegExp[]} - Array of regular expressions that will be evaluated to detect the users intent.
      • intent: {string[]} - Array of named intents returned by an IIntentRecognizer plugin that will be used to match the users intent.
    • dialogId: string | IDialogWaterfallStep[] | IDialogWaterfallStep
      • dialogId: _{string} - The ID of a dialog to begin when the intent is matched.
      • dialogId: {IDialogWaterfallStep[]} - Waterfall of steps to execute when the intent is matched.
      • dialogId: {IDialogWaterfallStep} - Single step waterfall to execute when the intent is matched. Calling a built-in prompt or starting a new dialog will result in the current dialog ending upon completion of the child prompt/dialog.
    • Optional dialogArgs: any

      (Optional) arguments to pass the dialog that started when dialogId is a {string}.

    Returns IntentDialog

onBegin

  • Called when the dialog is first loaded after a call to session.beginDialog(). This gives the bot an opportunity to process arguments passed to the dialog. Handlers should always call the next() function to continue execution of the dialogs main logic.

    Parameters

    • handler: function

      Function to invoke when the dialog begins.

        • (session: Session, args: any, next: function): void
        • Parameters

          • session: Session

            Session object for the current conversation.

          • args: any

            Arguments passed to the dialog in the session.beginDialog() call.

          • next: function

            Function to call when handler is finished to continue execution of the dialog.

              • (): void
              • Returns void

          Returns void

    Returns IntentDialog

onDefault

  • The default handler to invoke when there are no handlers that match the users intent.

    NOTE: The full details of the recognition attempt, including the list of intents & entities detected, will be passed to the args of the first waterfall step or dialog that's started.

    Parameters

    • dialogId: string | IDialogWaterfallStep[] | IDialogWaterfallStep
      • dialogId: _{string} - The ID of a dialog to begin.
      • dialogId: {IDialogWaterfallStep[]} - Waterfall of steps to execute.
      • dialogId: {IDialogWaterfallStep} - Single step waterfall to execute. Calling a built-in prompt or starting a new dialog will result in the current dialog ending upon completion of the child prompt/dialog.
    • Optional dialogArgs: any

      (Optional) arguments to pass the dialog that started when dialogId is a {string}.

    Returns IntentDialog

recognize

  • Parses the users utterance and assigns a score from 0.0 - 1.0 indicating how confident the dialog is that it understood the users utterance. This method is always called for the active dialog on the stack. A score of 1.0 will indicate a perfect match and terminate any further recognition.

    When the score is less than 1.0, every dialog on the stack will have its recognizeAction() method called as well to see if there are any named actions bound to the dialog that better matches the users utterance. Global actions registered at the bot level will also be evaluated. If the dialog has a score higher then any bound actions, the dialogs replyReceived() method will be called with the result object returned from the recognize() call. This lets the dialog pass additional data collected during the recognize phase to the replyReceived() method for handling.

    Should there be an action with a higher score then the dialog the action will be invoked instead of the dialogs replyReceived() method. The dialog will stay on the stack and may be resumed at some point should the action invoke a new dialog so dialogs should prepare for unexpected calls to dialogResumed().

    Parameters

    Returns void

recognizer

reloadAction

  • Binds an action to the dialog that will cause the dialog to be reloaded anytime its triggered. This is useful to implement logic that handle user utterances like "start over".

    Parameters

    • name: string

      Unique name to assign the action.

    • Optional msg: string | string[] | IMessage | IIsMessage

      (Optional) message to send the user prior to reloading the dialog.

    • Optional options: IBeginDialogActionOptions

      (Optional) options used to configure the action. If matches is specified the action will listen for the user to say a word or phrase that triggers the action, otherwise the action needs to be bound to a button using CardAction.dialogAction() to trigger the action. You can also use dialogArgs to pass additional params to the dialog when reloaded.

    Returns Dialog

replyReceived

selectActionRoute

triggerAction

  • Binds an action to the dialog that will make it the active dialog anytime its triggered. The default behaviour is to interupt any existing dialog by clearing the stack and starting the dialog at the root of the stack. The dialog being interrupted can intercept this interruption by adding a custom onInterrupted handler to their trigger action options. Additionally, you can customize the way the triggered dialog is started by providing a custom onSelectAction handler to your trigger action options.

    Parameters

    Returns Dialog

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method