How to use the botbuilder.CardFactory.heroCard function in botbuilder

To help you get started, we’ve selected a few botbuilder 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-Samples / samples / javascript_nodejs / 50.diceroller-skill / dialogs / helpDialog.js View on Github external
async beginDialog(dc, options) {
        // Format help card and message
        const card = CardFactory.heroCard(getText('en', 'help_title'), undefined, ['Roll Dice', 'Play Craps']);
        const msg = MessageFactory.attachment(card);
        msg.speak = ssml.speak(getText('en', 'help_ssml'));
        msg.inputHint = InputHints.AcceptingInput;

        // Send card and end dialog
        await dc.context.sendActivity(msg);
        return await dc.endDialog();
    }
}
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 23.facebook-events / bots / facebookBot.js View on Github external
// Process the message by checking the Activity.Text.  The FacebookQuickReply could also contain a json payload.

        // Initially the bot offers to showcase 3 Facebook features: Quick replies, PostBack and getting the Facebook Page Name.
        switch (turnContext.activity.text) {
        // Here we showcase how to obtain the Facebook page id.
        // This can be useful for the Facebook multi-page support provided by the Bot Framework.
        // The Facebook page id from which the message comes from is in turnContext.Activity.Recipient.Id.
        case facebookPageIdOption:

            await turnContext.sendActivity(`This message comes from the following Facebook Page: ${ turnContext.activity.recipient.id }`);
            await this.showChoices(turnContext);
            break;
        // Here we send a HeroCard with 2 options that will trigger a Facebook PostBack.
        case postBackOption:
            var card = CardFactory.heroCard(
                'Is 42 the answer to the ultimate question of Life, the Universe, and Everything?',
                null,
                CardFactory.actions([
                    {
                        type: ActionTypes.PostBack,
                        title: 'Yes',
                        value: 'Yes'
                    },

                    {
                        type: ActionTypes.PostBack,
                        title: 'No',
                        value: 'No'
                    }
                ])
            );
github microsoft / BotBuilder-Samples / samples / typescript_nodejs / 06.using-cards / src / dialogs / mainDialog.ts View on Github external
private createHeroCard() {
        return CardFactory.heroCard(
            'BotFramework Hero Card',
            CardFactory.images(['https://sec.ch9.ms/ch9/7ff5/e07cfef0-aa3b-40bb-9baa-7c9ef8ff7ff5/buildreactionbotframework_960.jpg']),
            CardFactory.actions([
                {
                    title: 'Get started',
                    type: 'openUrl',
                    value: 'https://docs.microsoft.com/en-us/azure/bot-service/'
                }
            ])
        );
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 03.welcome-users / bots / welcomeBot.js View on Github external
async sendIntroCard(context) {
        const card = CardFactory.heroCard(
            'Welcome to Bot Framework!',
            'Welcome to Welcome Users bot sample! This Introduction card is a great way to introduce your Bot to the user and suggest some things to get them started. We use this opportunity to recommend a few next steps for learning more creating and deploying bots.',
            ['https://aka.ms/bf-welcome-card-image'],
            [
                {
                    type: ActionTypes.OpenUrl,
                    title: 'Get an overview',
                    value: 'https://docs.microsoft.com/en-us/azure/bot-service/?view=azure-bot-service-4.0'
                },
                {
                    type: ActionTypes.OpenUrl,
                    title: 'Ask a question',
                    value: 'https://stackoverflow.com/questions/tagged/botframework'
                },
                {
                    type: ActionTypes.OpenUrl,
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 57.teams-conversation-bot / bots / teamsConversationBot.js View on Github external
switch (context.activity.text.trim()) {
            case 'MentionMe':
                await this.mentionActivityAsync(context);
                break;
            case 'UpdateCardAction':
                await this.updateCardActivityAsync(context);
                break;
            case 'Delete':
                await this.deleteCardActivityAsync(context);
                break;
            case 'MessageAllMembers':
                await this.messageAllMembersAsync(context);
                break;
            default:
                const value = { count: 0 };
                const card = CardFactory.heroCard(
                    'Welcome Card',
                    null,
                    [
                        {
                            type: ActionTypes.MessageBack,
                            title: 'Update Card',
                            value: value,
                            text: 'UpdateCardAction'
                        },
                        {
                            type: ActionTypes.MessageBack,
                            title: 'Message all members',
                            value: null,
                            text: 'MessageAllMembers'
                        }]);
                await context.sendActivity({ attachments: [card] });
github hinojosachapel / CorePlus / typescript_nodejs / src / dialogs / shared / utils.ts View on Github external
static getHeroCard(buttons: string[], cardTitle: string): Partial {
        const cardActions: CardAction[] = [];

        buttons.forEach(element => {
            cardActions.push({
                value: element,
                type: 'imBack',
                title: element
            });
        });

        const heroCard: Attachment = CardFactory.heroCard(
            cardTitle,
            [],
            CardFactory.actions(cardActions));

        return { attachments: [heroCard] };
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 11.qnamaker / utils / qnaCardBuilder.js View on Github external
static GetQnAPromptsCard(result) {
        var cardActions = [];
        result.context.prompts.forEach(prompt => {
            cardActions.push({
                value: prompt.displayText,
                type: ActionTypes.ImBack,
                title: prompt.displayText
            });
        });

        var heroCard = CardFactory.heroCard('', result.answer, [], CardFactory.actions(cardActions));
        return { attachments: [heroCard] };
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 06.using-cards / dialogs / mainDialog.js View on Github external
createHeroCard() {
        return CardFactory.heroCard(
            'BotFramework Hero Card',
            CardFactory.images(['https://sec.ch9.ms/ch9/7ff5/e07cfef0-aa3b-40bb-9baa-7c9ef8ff7ff5/buildreactionbotframework_960.jpg']),
            CardFactory.actions([
                {
                    type: 'openUrl',
                    title: 'Get started',
                    value: 'https://docs.microsoft.com/en-us/azure/bot-service/'
                }
            ])
        );
    }
github microsoft / botbuilder-js / samples / rich-cards-es6 / bot.js View on Github external
function createHeroCard() {
    return CardFactory.heroCard(
        'BotFramework Hero Card',
        CardFactory.images(['https://sec.ch9.ms/ch9/7ff5/e07cfef0-aa3b-40bb-9baa-7c9ef8ff7ff5/buildreactionbotframework_960.jpg']),
        CardFactory.actions([
            {
                type: 'openUrl',
                title: 'Get Started',
                value: 'https://docs.microsoft.com/en-us/azure/bot-service/'
            }
        ])
    );
}
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 52.teams-messaging-extensions-search-auth-config / bots / teamsMessagingExtensionsSearchAuthConfigBot.js View on Github external
response.data.objects.forEach(obj => {
                const heroCard = CardFactory.heroCard(obj.package.name);
                const preview = CardFactory.heroCard(obj.package.name);
                preview.content.tap = { type: 'invoke', value: { description: obj.package.description } };
                attachments.push({ ...heroCard, preview });
            });
        }