How to use the botbuilder.CardFactory.actions 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 / MigrationV3V4 / Node / core-MultiDialogs-v4 / dialogs / hotels.js View on Github external
createHotelHeroCard (hotel) {
        return CardFactory.heroCard(
            hotel.name,
            `${hotel.rating} stars. ${hotel.numberOfReviews} reviews. From ${hotel.priceStarting} per night.`,
            CardFactory.images([hotel.image]),
            CardFactory.actions([
                {
                    type: 'openUrl',
                    title: 'More details',
                    value: `https://www.bing.com/search?q=hotels+in+${encodeURIComponent(hotel.location)}`
                }
            ])
        );
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 48.qnamaker-active-learning-bot / Helpers / dialogHelper.js View on Github external
value: element,
            type: 'imBack',
            title: element
        });
    });

    cardActions.push({
        value: cardNoMatchText,
        type: 'imBack',
        title: cardNoMatchText
    });

    var heroCard = CardFactory.heroCard(
        cardTitle,
        [],
        CardFactory.actions(cardActions));

    return { attachments: [heroCard] };
}
github microsoft / botbuilder-js / samples / rich-cards-es6 / bot.js View on Github external
{
                title: 'Data Transfer',
                price: '$38.45',
                quantity: 368,
                image: { url: 'https://github.com/amido/azure-vector-icons/raw/master/renders/traffic-manager.png' }
            },
            {
                title: 'App Service',
                price: '$45.00',
                quantity: 720,
                image: { url: 'https://github.com/amido/azure-vector-icons/raw/master/renders/cloud-service.png' }
            }
        ],
        tax: '$7.50',
        total: '$90.95',
        buttons: CardFactory.actions([
            {
                type: 'openUrl',
                title: 'More Information',
                value: 'https://azure.microsoft.com/en-us/pricing/details/bot-service/'
            }
        ])
    })
}
github microsoft / BotBuilder-Samples / samples / typescript_nodejs / 06.using-cards / src / dialogs / mainDialog.ts View on Github external
private createAudioCard() {
        return CardFactory.audioCard(
            'I am your father',
            ['https://www.mediacollege.com/downloads/sound-effects/star-wars/darthvader/darthvader_yourfather.wav'],
            CardFactory.actions([
                {
                    title: 'Read more',
                    type: 'openUrl',
                    value: 'https://en.wikipedia.org/wiki/The_Empire_Strikes_Back'
                }
            ]),
            {
                image: { url: 'https://upload.wikimedia.org/wikipedia/en/3/3c/SW_-_Empire_Strikes_Back.jpg', alt: '' },
                subtitle: 'Star Wars: Episode V - The Empire Strikes Back',
                text: 'The Empire Strikes Back (also known as Star Wars: Episode V – The Empire Strikes Back) is a 1980 American epic space opera film directed by Irvin Kershner. Leigh Brackett and Lawrence Kasdan wrote the screenplay, with George Lucas writing the film\'s story and serving as executive producer. The second installment in the original Star Wars trilogy, it was produced by Gary Kurtz for Lucasfilm Ltd. and stars Mark Hamill, Harrison Ford, Carrie Fisher, Billy Dee Williams, Anthony Daniels, David Prowse, Kenny Baker, Peter Mayhew and Frank Oz.'
            }
        );
    }
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 OfficeDev / BotBuilder-MicrosoftTeams-node / botbuilder-teams-js / src / activityProcessor / teamsFactory.ts View on Github external
public static adaptiveCardActions(actions: (CardAction | string)[] | undefined): IAdaptiveCardAction[] {
    let botBuilderBtns = CardFactory.actions(actions);
    let acActions: IAdaptiveCardAction[] = [];
    for (let i = 0; i < botBuilderBtns.length; ++i) {
      let btn = botBuilderBtns[i];
      let adapterBtn: IAdaptiveCardAction = {
        id: undefined,
        type: 'Action.Submit',
        title: btn.title,
        data: {},
      };
      delete btn.title;
      adapterBtn.data[ 'msteams' ] = btn;
      acActions.push(adapterBtn);
    }
    return acActions;
  }
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 / 24.bot-authentication-msgraph / bot.js View on Github external
async sendWelcomeMessage(turnContext) {
        const activity = turnContext.activity;
        if (activity && activity.membersAdded) {
            const heroCard = CardFactory.heroCard(
                'Welcome to GraphAuthenticationBot!',
                CardFactory.images(['https://botframeworksamples.blob.core.windows.net/samples/aadlogo.png']),
                CardFactory.actions([
                    {
                        type: ActionTypes.ImBack,
                        title: 'Me',
                        value: 'me'
                    },
                    {
                        type: ActionTypes.ImBack,
                        title: 'Recent',
                        value: 'recent'
                    },
                    {
                        type: ActionTypes.ImBack,
                        title: 'View Token',
                        value: 'view Token'
                    },
                    {
github microsoft / botbuilder-js / samples / rich-cards-es6 / bot.js View on Github external
function createAudioCard() {
    return CardFactory.audioCard(
        'I am your father',
        ['http://www.wavlist.com/movies/004/father.wav'],
        CardFactory.actions([
            {
                type: 'openUrl',
                title: 'Read More',
                value: 'https://en.wikipedia.org/wiki/The_Empire_Strikes_Back'
            }
        ]),
        {
            subtitle: 'Star Wars: Episode V - The Empire Strikes Back',
            text: 'The Empire Strikes Back (also known as Star Wars: Episode V – The Empire Strikes Back) is a 1980 American epic space opera film directed by Irvin Kershner. Leigh Brackett and Lawrence Kasdan wrote the screenplay, with George Lucas writing the film\'s story and serving as executive producer. The second installment in the original Star Wars trilogy, it was produced by Gary Kurtz for Lucasfilm Ltd. and stars Mark Hamill, Harrison Ford, Carrie Fisher, Billy Dee Williams, Anthony Daniels, David Prowse, Kenny Baker, Peter Mayhew and Frank Oz.',
            image: 'https://upload.wikimedia.org/wikipedia/en/3/3c/SW_-_Empire_Strikes_Back.jpg'
        }
    );
}
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 06.using-cards / dialogs / mainDialog.js View on Github external
createAudioCard() {
        return CardFactory.audioCard(
            'I am your father',
            ['https://www.mediacollege.com/downloads/sound-effects/star-wars/darthvader/darthvader_yourfather.wav'],
            CardFactory.actions([
                {
                    type: 'openUrl',
                    title: 'Read more',
                    value: 'https://en.wikipedia.org/wiki/The_Empire_Strikes_Back'
                }
            ]),
            {
                subtitle: 'Star Wars: Episode V - The Empire Strikes Back',
                text: 'The Empire Strikes Back (also known as Star Wars: Episode V – The Empire Strikes Back) is a 1980 American epic space opera film directed by Irvin Kershner. Leigh Brackett and Lawrence Kasdan wrote the screenplay, with George Lucas writing the film\'s story and serving as executive producer. The second installment in the original Star Wars trilogy, it was produced by Gary Kurtz for Lucasfilm Ltd. and stars Mark Hamill, Harrison Ford, Carrie Fisher, Billy Dee Williams, Anthony Daniels, David Prowse, Kenny Baker, Peter Mayhew and Frank Oz.',
                image: 'https://upload.wikimedia.org/wikipedia/en/3/3c/SW_-_Empire_Strikes_Back.jpg'
            }
        );
    }