Other dialogs

Botfuel Dialog offers several built-in dialogs in addition to a number of abstract dialog classes. This document covers all dialogs other than PromptDialog, for it see here.

Dialog

The Dialog is the generic class subclassed by all the others dialogs. This class exposes the execute method, which is not implemented.

/**
  * Executes the dialog.
  * @abstract
  * @async
  * @param {Object} userMessage - the user message
  * @param {Object} [data] - the dialog data
  * @returns {Promise.<Object>}
  */
async execute(userMessage, data)

The other important method of the Dialog class is the display method. It is called by the execute method.

/**
  * Displays messages by resolving the view associated to the dialog.
  * @async
  * @param {Object} userMessage - the user message
  * @param {Object} [data] - data used at display time
  * @returns {Promise.<void>}
  */
async display(userMessage, data)

Predefined dialogs other than Dialog and PromptDialog

BaseDialog

The BaseDialog is a general-purpose dialog. It is subclassed by many other dialogs.

CancellationDialog

The CancellationDialog is a PromptDialog used to cancel the current dialog. This dialog is provided with two views, one in English and one in French. To use this dialog, add an intent named cancellation to your bot in the Trainer. The intent should be trained according to your use case with phrases corresponding to cancellation.

CatchDialog

The CatchDialog is triggered when an unexpected error occurs (eg an API calls returns an error).

ClassificationDisambiguationDialog

The ClassificationDisambiguationDialog is triggered when the Classification service returns multiple intents or QnAs based on the user input.

ComplexInputDialog

The ComplexInputDialog is a dialog used to handle complex inputs. We consider an input to be complex if it has 256 characters or more.

ConfirmationDialog

The ConfirmationDialog is a PromptDialog used to unblock a blocked dialog. It is meant to be subclassed in order to allow the customization of the corresponding view.

DefaultDialog

The DefaultDialog is used when the bot does not understand the user input.

QnasDialog

The QnasDialog is used for answering QnAs.

VoidDialog

The VoidDialog does not do anything but can be used in tests.