Aura Bot main dialog

Description of the main dialog, one Aura Bot core dialog that maps the recognized intent with a specific dialog

Introduction

The main dialog is one of the aura-bot core dialogs in charge of routing from the recognized intention of the user to the specific dialog that provides the functionality required in an intended channel.

main dialog extends ComponentDialog, as all the rest of the dialogs. It is an internal dialog that contains all the intents-to-dialog routing map. It is loaded during the AuraBotserver start-up to be injected as a property in aura-bot and used after each intent recognition to execute the selected dialog.

At this stage, it is both instantiated and initialized, through these steps:

  • First, the whole list of plugins to be loaded in the system are passed to the dialog.
  • It also counts on the instance of the Aura BotFramework adapter, used during this start-up phase.
  • Then the WaterfallDialog with all the steps managed by the main dialog is added to the dialog.
  • After that, it is initialized:
    • A RoutingMap is created.
    • All the configured plugins are registered:
      • First of all, internal dialogs are included as dialogs: context-filter dialog and suggestions dialog.
      • Then, all the plugins configured in plugins-config are looped to add the routes of all their dialogs in the RoutingMap property of the main dialog, used during the activities processing to map the recognized intent to the corresponding dialog.

During the activity processing, the ActivityHandler calls MainDialog.run method to handle the incoming activity (in the form of a TurnContext), that passes it through the dialog system. If no dialog is active, it starts the default dialog. If there is any error in the TurnContext, the processing stops here and is sent to the channel.

At this stage, the main dialog is in charge of:

  • Routing the recognized intent to the dialog that handles it for the current channel.
  • Update Aura Context information of the current activity to include the dialog information.
  • If the dialog includes a contextFilter that fits the user’s context, then the dialog executed is the internal context-filter dialog.
  • If the user’s context does not match with the contextFilter of the dialog or the dialog does not have any contextFilter, then the next step of the main dialog is executed to validate if the Kernel accessToken of the user includes the scopes and purposes needed to execute the dialog.
    • If the accessToken has no permissions to access it, then an error is returned, notifying the channel that the user has not consented aura-bot to access the specific API.
    • If authorization is correct, then the specific dialog is executed.
  • When it ends, the next step of the main dialog is executed to check whether or not the dialog needs suggestions. If the dialog is configured to send suggestions and the user’s settings support them, then the internal SuggestionsDialog is executed.
  • When it ends, the main dialog also ends and an outgoing message flow is started.

Find here detailed information regarding the Routing Manager.