How to use the botbuilder-core.CardFactory.adaptiveCard function in botbuilder-core

To help you get started, we’ve selected a few botbuilder-core 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 / generators / generator-botbuilder / generators / app / templates / core / bots / dialogAndWelcomeBot.js View on Github external
this.onMembersAdded(async (context, next) => {
            const membersAdded = context.activity.membersAdded;
            for (let cnt = 0; cnt < membersAdded.length; cnt++) {
                if (membersAdded[cnt].id !== context.activity.recipient.id) {
                    const welcomeCard = CardFactory.adaptiveCard(WelcomeCard);
                    await context.sendActivity({ attachments: [welcomeCard] });
                    await dialog.run(context, conversationState.createProperty('DialogState'));
                }
            }

            // By calling next() you ensure that the next BotHandler is run.
            await next();
        });
    }
github microsoft / botbuilder-js / libraries / botbuilder-lg / src / activityFactory.ts View on Github external
private static getAttachment(input: any): Attachment {
        let attachment: Attachment = {
            contentType: ''
        };
        const type: string = this.getStructureType(input);
        if (ActivityChecker.genericCardTypeMapping.has(type)) {
            attachment = this.getCardAttachment(ActivityChecker.genericCardTypeMapping.get(type), input);
        } else if(type === 'adaptivecard') {
            attachment = CardFactory.adaptiveCard(input);
        } else if(type === 'attachment') {
            attachment = this.getNormalAttachment(input);
        } else {
            attachment = {contentType: type, content: input};
        }

        return attachment;
    }
github microsoft / BotBuilder-Samples / samples / javascript_typescript / 13.core-bot / src / bots / dialogAndWelcomeBot.ts View on Github external
this.onMembersAdded(async (context) => {
            const membersAdded = context.activity.membersAdded;
            for (const member of membersAdded) {
                if (member.id !== context.activity.recipient.id) {
                    const welcomeCard = CardFactory.adaptiveCard(WelcomeCard);
                    await context.sendActivity({ attachments: [welcomeCard] });
                }
            }
        });
    }