How to use the botbuilder-dialogs-adaptive.TextInput function in botbuilder-dialogs-adaptive

To help you get started, we’ve selected a few botbuilder-dialogs-adaptive 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 / 07. initProperty / src / index.ts View on Github external
// Listen for incoming activities.
server.post('/api/messages', (req, res) => {
    adapter.processActivity(req, res, async (context) => {
        // Route activity to bot.
        await bot.onTurn(context);
    });
});

// Initialize bots root dialog
const dialogs = new AdaptiveDialog();
bot.rootDialog = dialogs;

// Handle unknown intents
dialogs.addRule(new OnUnknownIntent([
    new InitProperty('dialog.list', 'array'),
    new TextInput("dialog.item", "What is your name?"),
    new EditArray(ArrayChangeType.push, 'dialog.list', 'dialog.item'),
    new SendActivity('Your name in an array: {dialog.list}')
]));
github microsoft / botbuilder-js / samples / 07. initProperty / lib / index.js View on Github external
const bot = new botbuilder_dialogs_1.DialogManager();
bot.conversationState = new botbuilder_1.ConversationState(new botbuilder_1.MemoryStorage());
// Listen for incoming activities.
server.post('/api/messages', (req, res) => {
    adapter.processActivity(req, res, async (context) => {
        // Route activity to bot.
        await bot.onTurn(context);
    });
});
// Initialize bots root dialog
const dialogs = new botbuilder_dialogs_adaptive_1.AdaptiveDialog();
bot.rootDialog = dialogs;
// Handle unknown intents
dialogs.triggers.push(new botbuilder_dialogs_adaptive_1.OnUnknownIntent([
    new botbuilder_dialogs_adaptive_1.InitProperty('dialog.list', 'array'),
    new botbuilder_dialogs_adaptive_1.TextInput("dialog.item", "What is your name?"),
    new botbuilder_dialogs_adaptive_1.EditArray(botbuilder_dialogs_adaptive_1.ArrayChangeType.push, 'dialog.list', 'dialog.item'),
    new botbuilder_dialogs_adaptive_1.SendActivity('Your name in an array: {dialog.list}')
]));
//# sourceMappingURL=index.js.map
github microsoft / botbuilder-js / samples / 05. beginDialog / lib / index.js View on Github external
//=================================================================================================
dialogs.recognizer = new botbuilder_dialogs_adaptive_1.RegExpRecognizer().addIntent('JokeIntent', /tell .*joke/i);
// Tell the user a joke
dialogs.addRule(new botbuilder_dialogs_adaptive_1.OnIntent('#JokeIntent', [], [
    new botbuilder_dialogs_adaptive_1.BeginDialog('TellJokeDialog')
]));
// Handle unknown intents
dialogs.addRule(new botbuilder_dialogs_adaptive_1.OnUnknownIntent([
    new botbuilder_dialogs_adaptive_1.BeginDialog('AskNameDialog')
]));
//=================================================================================================
// Child Dialogs
//=================================================================================================
const askNameDialog = new botbuilder_dialogs_adaptive_1.AdaptiveDialog('AskNameDialog', [
    new botbuilder_dialogs_adaptive_1.IfCondition('user.name == null', [
        new botbuilder_dialogs_adaptive_1.TextInput('user.name', `Hi! what's your name?`)
    ]),
    new botbuilder_dialogs_adaptive_1.SendActivity(`Hi {user.name}. It's nice to meet you.`),
    new botbuilder_dialogs_adaptive_1.EndDialog()
]);
dialogs.actions.push(askNameDialog);
const tellJokeDialog = new botbuilder_dialogs_adaptive_1.AdaptiveDialog('TellJokeDialog', [
    new botbuilder_dialogs_adaptive_1.SendActivity(`Why did the 🐔 cross the 🛣️?`),
    new botbuilder_dialogs_adaptive_1.EndTurn(),
    new botbuilder_dialogs_adaptive_1.SendActivity(`To get to the other side...`),
    new botbuilder_dialogs_adaptive_1.EndDialog()
]);
dialogs.actions.push(tellJokeDialog);
//# sourceMappingURL=index.js.map
github microsoft / botbuilder-js / samples / 05. beginDialog / src / index.ts View on Github external
new BeginDialog('TellJokeDialog')
]));

// Handle unknown intents
dialogs.addRule(new OnUnknownIntent([
    new BeginDialog('AskNameDialog')
]));


//=================================================================================================
// Child Dialogs
//=================================================================================================

const askNameDialog = new AdaptiveDialog('AskNameDialog', [
    new IfCondition('user.name == null', [
        new TextInput('user.name', `Hi! what's your name?`)
    ]),
    new SendActivity(`Hi {user.name}. It's nice to meet you.`),
    new EndDialog()
]);
dialogs.actions.push(askNameDialog);

const tellJokeDialog = new AdaptiveDialog('TellJokeDialog',[
    new SendActivity(`Why did the 🐔 cross the 🛣️?`),
    new EndTurn(),
    new SendActivity(`To get to the other side...`),
    new EndDialog()
]);
dialogs.actions.push(tellJokeDialog);
github microsoft / botbuilder-js / samples / 09. traceActivity / lib / index.js View on Github external
// Create bots DialogManager and bind to state storage
const bot = new botbuilder_dialogs_1.DialogManager();
bot.conversationState = new botbuilder_1.ConversationState(new botbuilder_1.MemoryStorage());
// Listen for incoming activities.
server.post('/api/messages', (req, res) => {
    adapter.processActivity(req, res, async (context) => {
        // Route activity to bot.
        await bot.onTurn(context);
    });
});
// Initialize bots root dialog
const dialogs = new botbuilder_dialogs_adaptive_1.AdaptiveDialog();
bot.rootDialog = dialogs;
// Handle unknown intents
dialogs.triggers.push(new botbuilder_dialogs_adaptive_1.OnUnknownIntent([
    new botbuilder_dialogs_adaptive_1.TextInput("dialog.name", "what is your name?"),
    new botbuilder_dialogs_adaptive_1.TraceActivity(null, "memory", "dialog"),
]));
//# sourceMappingURL=index.js.map
github microsoft / botbuilder-js / samples / 09. traceActivity / src / index.ts View on Github external
// Listen for incoming activities.
server.post('/api/messages', (req, res) => {
    adapter.processActivity(req, res, async (context) => {
        // Route activity to bot.
        await bot.onTurn(context);
    });
});

// Initialize bots root dialog
const dialogs = new AdaptiveDialog();
bot.rootDialog = dialogs;

// Handle unknown intents
dialogs.triggers.push(new OnUnknownIntent([
    new TextInput("dialog.name", "what is your name?"),
    new TraceActivity(null, "memory", "dialog"),
]));
github microsoft / BotBuilder-Samples / experimental / adaptive-dialog / javascript_nodejs / 05.multi-turn-prompt / dialogs / userProfileDialog.js View on Github external
constructor() {
        super('userProfileDialog');
        let lgFile = Templates.parseFile(path.join(__dirname, "userProfileDialog.lg"));
        let 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.Text()}")
                    }),
                    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(
                    {
github microsoft / botbuilder-js / samples / 50. todo-bot / src / addToDo / index.ts View on Github external
constructor() {
        super('AddToDo', [
            new TextInput('$title', '@title', `What would you like to call your new todo?`),
            new EditArray(ArrayChangeType.push, 'user.todos', '$title'),
            new SendActivity(`Added a todo named "{$title}". You can delete it by saying "delete todo named {$title}".`),
            new IfCondition(`user.tips.showToDos != true`, [
                new SendActivity(`To view your todos just ask me to "show my todos".`),
                new SetProperty('user.tips.showToDos', 'true')
            ])
        ]);

        // Use parents recognizer
        this.recognizer = getRecognizer();

        // Add interruption rules
        this.addRule(new OnIntent('#Cancel', [], [
            new CancelAllDialogs('cancelAdd')
        ]));
    }
github microsoft / botbuilder-js / samples / 03. ifCondition / lib / index.js View on Github external
bot.conversationState = new botbuilder_1.ConversationState(new botbuilder_1.MemoryStorage());
bot.userState = new botbuilder_1.UserState(new botbuilder_1.MemoryStorage());
// Listen for incoming activities.
server.post('/api/messages', (req, res) => {
    adapter.processActivity(req, res, async (context) => {
        // Route activity to bot.
        await bot.onTurn(context);
    });
});
// Initialize bots root dialog
const dialogs = new botbuilder_dialogs_adaptive_1.AdaptiveDialog();
bot.rootDialog = dialogs;
// Handle unknown intents
dialogs.triggers.push(new botbuilder_dialogs_adaptive_1.OnUnknownIntent([
    new botbuilder_dialogs_adaptive_1.IfCondition('user.name == null', [
        new botbuilder_dialogs_adaptive_1.TextInput('user.name', `Hi! what's your name?`),
    ]),
    new botbuilder_dialogs_adaptive_1.SendActivity(`Hi {user.name}. It's nice to meet you.`)
]));
//# sourceMappingURL=index.js.map
github microsoft / botbuilder-js / samples / 02. textInput / lib / index.js View on Github external
bot.conversationState = new botbuilder_1.ConversationState(new botbuilder_1.MemoryStorage());
bot.userState = new botbuilder_1.UserState(new botbuilder_1.MemoryStorage());
// Listen for incoming activities.
server.post('/api/messages', (req, res) => {
    adapter.processActivity(req, res, async (context) => {
        // Route activity to bot.
        await bot.onTurn(context);
    });
});
// Initialize bots root dialog
const dialogs = new botbuilder_dialogs_adaptive_1.AdaptiveDialog();
bot.rootDialog = dialogs;
// Handle unknown intents
dialogs.triggers.push(new botbuilder_dialogs_adaptive_1.OnUnknownIntent([
    new botbuilder_dialogs_adaptive_1.SetProperty('user.name', 'null'),
    new botbuilder_dialogs_adaptive_1.TextInput('user.name', `Hi! what's your name?`),
    new botbuilder_dialogs_adaptive_1.SendActivity(`Hi {user.name}. It's nice to meet you.`)
]));
//# sourceMappingURL=index.js.map