How to use the botframework-schema.ActionTypes.ImBack function in botframework-schema

To help you get started, we’ve selected a few botframework-schema 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 / botframework-solutions / templates / Virtual-Assistant-Template / typescript / generator-botbuilder-assistant / generators / app / templates / sample-assistant / src / responses / mainResponses.ts View on Github external
public static async buildNewUserGreetingCard(turnContext: TurnContext, data: any): Promise {
        const introFileName: string = i18next.t('main.introGreetingFile');
        const introPath: string = join(__dirname, '..', 'content', introFileName);
        // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/tslint/config
        const introCard: any = JSON.parse(readFileSync(introPath, 'UTF8'));
        const attachment: Attachment = CardFactory.adaptiveCard(introCard);
        // eslint-disable-next-line @typescript-eslint/tslint/config
        const response: Partial = MessageFactory.attachment(attachment, '', attachment.content.speak, InputHints.AcceptingInput);

        response.suggestedActions = {
            actions: [
                {
                    title: i18next.t('main.helpBtnText1'),
                    type: ActionTypes.ImBack,
                    value: i18next.t('main.helpBtnValue1')
                },
                {
                    title: i18next.t('main.helpBtnText2'),
                    type: ActionTypes.ImBack,
                    value: i18next.t('main.helpBtnValue2')
                },
                {
                    title: i18next.t('main.helpBtnText3'),
                    type: ActionTypes.OpenUrl,
                    value: i18next.t('main.helpBtnValue3')
                }
            ],
            to: []
        };
github microsoft / botframework-solutions / templates / Virtual-Assistant-Template / typescript / samples / sample-assistant / src / responses / mainResponses.ts View on Github external
public static buildNewUserGreetingCard(turnContext: TurnContext, data: any): Promise {
        const introFileName: string = i18next.t('main.introGreetingFile');
        const introPath: string = join(__dirname, '..', 'content', introFileName);
        // tslint:disable-next-line:no-any non-literal-require
        const introCard: any = require(introPath);
        const attachment: Attachment = CardFactory.adaptiveCard(introCard);
        const response: Partial = MessageFactory.attachment(attachment, '', attachment.content.speak, InputHints.AcceptingInput);

        response.suggestedActions = {
            actions: [
                {
                    title: i18next.t('main.helpBtnText1'),
                    type: ActionTypes.ImBack,
                    value: i18next.t('main.helpBtnValue1')
                },
                {
                    title: i18next.t('main.helpBtnText2'),
                    type: ActionTypes.ImBack,
                    value: i18next.t('main.helpBtnValue2')
                },
                {
                    title: i18next.t('main.helpBtnText3'),
                    type: ActionTypes.OpenUrl,
                    value: i18next.t('main.helpBtnValue3')
                }
            ],
            to: []
        };
github microsoft / botframework-solutions / templates / Virtual-Assistant-Template / typescript / generator-botbuilder-assistant / generators / app / templates / sample-assistant / src / responses / mainResponses.ts View on Github external
public static async buildHelpCard(turnContext: TurnContext, data: any): Promise {
        const title: string = i18next.t('main.helpTitle');
        const text: string = i18next.t('main.helpText');
        const attachment: Attachment = CardFactory.heroCard(title, text);
        const response: Partial = MessageFactory.attachment(attachment, text, InputHints.AcceptingInput);

        response.suggestedActions = {
            actions: [
                {
                    title: i18next.t('main.helpBtnText1'),
                    type: ActionTypes.ImBack,
                    value: i18next.t('main.helpBtnValue1')
                },
                {
                    title: i18next.t('main.helpBtnText2'),
                    type: ActionTypes.ImBack,
                    value: i18next.t('main.helpBtnValue2')
                },
                {
                    title: i18next.t('main.helpBtnText3'),
                    type: ActionTypes.OpenUrl,
                    value: i18next.t('main.helpBtnValue3')
                }
            ],
            to: []
        };

        return Promise.resolve(response);
    }
github microsoft / botbuilder-js / libraries / botbuilder-lg / src / activityFactory.ts View on Github external
private static getCardAction(action: any): CardAction
    {
        let cardAction: CardAction;
        if (typeof action === 'string') {
            cardAction = { type: ActionTypes.ImBack, value: action, title: action, channelData: undefined };
        } else {
            const type: string = this.getStructureType(action);
            cardAction = {
                type: ActionTypes.ImBack,
                title: '',
                value: ''
            };

            if(type === 'cardaction') {
                for (const key of Object.keys(action)) {
                    const property: string = key.trim();
                    if (property === Evaluator.LGType) {
                        continue;
                    }

                    const value: any = action[key];

                    switch (property.toLowerCase()) {
                        case 'displaytext':
                            cardAction.displayText = value;
github microsoft / botframework-solutions / templates / Virtual-Assistant-Template / typescript / samples / sample-assistant / src / responses / mainResponses.ts View on Github external
public static buildHelpCard(turnContext: TurnContext, data: any): Promise {
        const title: string = i18next.t('main.helpTitle');
        const text: string = i18next.t('main.helpText');
        const attachment: Attachment = CardFactory.heroCard(title, text);
        const response: Partial = MessageFactory.attachment(attachment, text, InputHints.AcceptingInput);

        response.suggestedActions = {
            actions: [
            {
                title: i18next.t('main.helpBtnText1'),
                type: ActionTypes.ImBack,
                value: i18next.t('main.helpBtnValue1')
            },
            {
                title: i18next.t('main.helpBtnText2'),
                type: ActionTypes.ImBack,
                value: i18next.t('main.helpBtnValue2')
            },
            {
                title: i18next.t('main.helpBtnText3'),
                type: ActionTypes.OpenUrl,
                value: i18next.t('main.helpBtnValue3')
            }
            ],
            to: []
        };

        return Promise.resolve(response);
    }