How to use the botbuilder-dialogs.WaterfallDialog function in botbuilder-dialogs

To help you get started, we’ve selected a few botbuilder-dialogs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / botbuilder-js / samples / dialogs / alarmbot-ts / src / dialogs / deleteAlarmDialog.ts View on Github external
constructor(dialogId: string, private alarmsProperty: StatePropertyAccessor<Alarm[]>) {
        super(dialogId);

        // waterfall dialog for dealing with multiple dialogs
        this.addDialog(new WaterfallDialog(DELETE_MULTI_DIALOG, [
            this.chooseAlarmStep,
            this.deleteChosenAlarmStep
        ]));

        // waterfall dialog for deleting a single dialog
        this.addDialog(new WaterfallDialog(DELETE_SINGLE_DIALOG, [
            this.confirmDeleteSingleStep,
            this.confirmedDeleteSingleAlarmStep
        ]));

        // Add support prompts
        this.addDialog(new ChoicePrompt(CHOOSE_ALARM_PROMPT));
        this.addDialog(new ConfirmPrompt(CONFIRM_DELETE_PROMPT));
    }
github microsoft / botframework-solutions / templates / Virtual-Assistant-Template / typescript / generator-botbuilder-assistant / generators / skill / templates / sample-skill / src / dialogs / sampleDialog.ts View on Github external
responseManager: ResponseManager,
        stateAccessor: StatePropertyAccessor<SkillState>,
        telemetryClient: BotTelemetryClient
    ) {
        super(SampleDialog.name, settings, services, responseManager, stateAccessor, telemetryClient);

        const sample: ((sc: WaterfallStepContext) => Promise<DialogTurnResult>)[] = [
            // NOTE: Uncomment these lines to include authentication steps to this dialog
            // GetAuthToken,
            // AfterGetAuthToken,
            this.promptForName.bind(this),
            this.greetUser.bind(this),
            this.end.bind(this)
        ];

        this.addDialog(new WaterfallDialog(SampleDialog.name, sample));
        this.addDialog(new TextPrompt(DialogIds.namePrompt));

        this.initialDialogId = SampleDialog.name;
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 24.bot-authentication-msgraph / bot.js View on Github external
// Instructions for the user with information about commands that this bot may handle.
        this.helpMessage = `You can type "send <recipient_email>" to send an email, "recent" to view recent unread mail,` +
            ` "me" to see information about your, or "help" to view the commands` +
            ` again. Any other text will display your token.`;

        // Create a DialogSet that contains the OAuthPrompt.
        this.dialogs = new DialogSet(this.dialogState);

        // Add an OAuthPrompt with the connection name as specified on the Bot's settings blade in Azure.
        this.dialogs.add(OAuthHelpers.prompt(CONNECTION_SETTING_NAME));

        this._graphDialogId = 'graphDialog';

        // Logs in the user and calls proceeding dialogs, if login is successful.
        this.dialogs.add(new WaterfallDialog(this._graphDialogId, [
            this.promptStep.bind(this),
            this.processStep.bind(this)
        ]));
    };
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 25.logger / bot.js View on Github external
}
            }

            return false;
        }));

        // Create a dialog that asks the user for their name.
        this.dialogs.add(new WaterfallDialog(WHO_ARE_YOU, [
            this.promptForName.bind(this),
            this.confirmAgePrompt.bind(this),
            this.promptForAge.bind(this),
            this.captureAge.bind(this)
        ]));

        // Create a dialog that displays a user name after it has been collected.
        this.dialogs.add(new WaterfallDialog(HELLO_USER, [
            this.displayProfile.bind(this)
        ]));
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 04.simple-prompt / bot.js View on Github external
// creates a new state accessor property.
        // See https://aka.ms/about-bot-state-accessors to learn more about the bot state and state accessors
        this.conversationState = conversationState;
        this.userState = userState;

        this.dialogState = this.conversationState.createProperty(DIALOG_STATE_PROPERTY);

        this.userName = this.userState.createProperty(USER_NAME_PROP);

        this.dialogs = new DialogSet(this.dialogState);

        // Add prompts
        this.dialogs.add(new TextPrompt(NAME_PROMPT));

        // Create a dialog that asks the user for their name.
        this.dialogs.add(new WaterfallDialog(WHO_ARE_YOU, [
            this.askForName.bind(this),
            this.collectAndDisplayName.bind(this)
        ]));

        // Create a dialog that displays a user name after it has been collected.
        this.dialogs.add(new WaterfallDialog(HELLO_USER, [
            this.displayName.bind(this)
        ]));
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 50.diceroller-skill / dialogs / rollAgainDialog.js View on Github external
constructor(dialogId, currentGameProperty) {
        super(dialogId);

        this.currentGameProperty = currentGameProperty;
        // Add control flow dialogs
        this.addDialog(new WaterfallDialog(START_DIALOG, [
            this.ensureGameStep.bind(this),
            this.rollDiceStep.bind(this)
        ]));
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 06.using-cards / dialogs / mainDialog.js View on Github external
constructor(logger) {
        super('MainDialog');

        if (!logger) {
            logger = console;
            logger.log('[MainDialog]: logger not passed in, defaulting to console');
        }

        this.logger = logger;

        // Define the main dialog and its related components.
        this.addDialog(new ChoicePrompt('cardPrompt'));
        this.addDialog(new WaterfallDialog(MAIN_WATERFALL_DIALOG, [
                this.choiceCardStep.bind(this),
                this.showCardStep.bind(this)
            ]));

        // The initial child Dialog to run.
        this.initialDialogId = MAIN_WATERFALL_DIALOG;
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 13.core-bot / dialogs / bookingDialog.js View on Github external
constructor(id) {
        super(id || 'bookingDialog');

        this.addDialog(new TextPrompt(TEXT_PROMPT))
            .addDialog(new ConfirmPrompt(CONFIRM_PROMPT))
            .addDialog(new DateResolverDialog(DATE_RESOLVER_DIALOG))
            .addDialog(new WaterfallDialog(WATERFALL_DIALOG, [
                this.destinationStep.bind(this),
                this.originStep.bind(this),
                this.travelDateStep.bind(this),
                this.confirmStep.bind(this),
                this.finalStep.bind(this)
            ]));

        this.initialDialogId = WATERFALL_DIALOG;
    }
github microsoft / botframework-solutions / solutions / Virtual-Assistant / src / typescript / assistant / src / dialogs / escalate / escalateDialog.ts View on Github external
constructor(botServices: BotServices, telemetryClient: BotTelemetryClient) {
        super(botServices, EscalateDialog.name, telemetryClient);
        this.initialDialogId = EscalateDialog.name;
        const escalate: ((sc: WaterfallStepContext<{}>) => Promise<DialogTurnResult>)[] = [
            EscalateDialog.sendEscalationMessage.bind(this)
        ];
        this.addDialog(new WaterfallDialog(this.initialDialogId, escalate));
    }
github microsoft / BotBuilder-Samples / generators / generator-botbuilder / generators / app / templates / core / dialogs / dateResolverDialog.ts View on Github external
constructor(id: string) {
        super(id || 'dateResolverDialog');
        this.addDialog(new DateTimePrompt(DATETIME_PROMPT, DateResolverDialog.dateTimePromptValidator.bind(this)))
            .addDialog(new WaterfallDialog(WATERFALL_DIALOG, [
                this.initialStep.bind(this),
                this.finalStep.bind(this)
            ]));

        this.initialDialogId = WATERFALL_DIALOG;
    }