2

Below is a sample of an Adaptive dialog

            const userProfileAdaptiveDialog = new AdaptiveDialog(ROOT_DIALOG).configure({
            generator: new TemplateEngineLanguageGenerator(lgFile),
            triggers: [
                new OnBeginDialog([
                    // Ask for user's age and set it in user.userProfile scope.
                    new TextInput().configure(
                        {
                            // Set the output of the text input to this property in memory.
                            property: new StringExpression('user.userProfile.Transport'),
                            prompt: new ActivityTemplate('${ModeOfTransportPrompt()}')
                        }),
                    new TextInput().configure(
                        {
                            property: new StringExpression('user.userProfile.Name'),
                            prompt: new ActivityTemplate('${AskForName()}')
                        }),
                    // SendActivity supports full language generation resolution.
                    // See here to learn more about language generation
                    // https://aka.ms/language-generation
                    new SendActivity('${AckName()}'),
                    new ConfirmInput().configure(
                        {
                            property: new StringExpression('turn.ageConfirmation'),
                            prompt: new ActivityTemplate('${AgeConfirmPrompt()}')
                        }),
                    new IfCondition().configure(
                        {
                            // All conditions are expressed using the common expression language.
                            // See https://aka.ms/adaptive-expressions to learn more
                            condition: new BoolExpression('turn.ageConfirmation == true'),
                            actions: [
                                new NumberInput().configure(
                                    {
                                        prompt: new ActivityTemplate('${AskForAge()}'),
                                        property: new StringExpression('user.userProfile.Age'),
                                        // Add validations
                                        validations: [
                                            // Age must be greater than or equal 1
                                            'int(this.value) >= 1',
                                            // Age must be less than 150
                                            'int(this.value) < 150'
                                        ],
                                        invalidPrompt: new ActivityTemplate('${AskForAge.invalid()}'),
                                        unrecognizedPrompt: new ActivityTemplate('${AskForAge.unRecognized()}')
                                    }),
                                new SendActivity('${UserAgeReadBack()}')
                            ],
                            elseActions: [
                                new SendActivity('${NoAge()}')
                            ]
                        }),
                    new IfCondition().configure(
                        {
                            condition: new BoolExpression('turn.activity.channelId == "msteams"'),
                            actions: [
                                // This attachment prompt example is not designed to work for Teams attachments, so skip it in this case
                                new SendActivity('Skipping attachment prompt in Teams channel...')
                            ],
                            elseActions: [
                                new AttachmentInput().configure(
                                    {
                                        prompt: new ActivityTemplate('${AskForImage()}'),
                                        property: new StringExpression('user.userProfile.picture'),
                                        validations: [
                                            'this.value.contentType == "image/jpeg" || this.value.contentType == "image/png"'
                                        ],
                                        invalidPrompt: new ActivityTemplate('${AskForImage.Invalid()}')
                                    })
                            ]
                        }),
                    new ConfirmInput().configure(
                        {
                            prompt: new ActivityTemplate('${ConfirmPrompt()}'),
                            property: new StringExpression('turn.finalConfirmation')
                        }),
                    // Use LG template to come back with the final read out.
                    // This LG template is a great example of what logic can be wrapped up in LG sub-system.
                    new SendActivity('${FinalUserProfileReadOut()}') // examines turn.finalConfirmation
            
                }])
            ]
        });

it is configured like an object unlike waterfall dialog because of this i'm not able to write any control & console statements within dialog, i want fetch user input and based on that i have to ask the next question how can i do this?

how can i console log user input?

ChinnarajS
  • 644
  • 5
  • 20
  • 1
    Looking at your code, it doesn't look like the flow would change ever. There is no need to use the adaptive dialog feature if it's never going to be utilized. If that is the case, I would recommend you switch to using a [waterfall dialog](https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-dialog-manage-conversation-flow?view=azure-bot-service-4.0&tabs=javascript) which will certainly allow you to include console statements. – Steven Kanberg Nov 18 '21 at 22:06

0 Answers0