BotBuilder-MicrosoftTeams icon indicating copy to clipboard operation
BotBuilder-MicrosoftTeams copied to clipboard

Node.js Teams botbuilder package: Message extension - Responding with a card inserted into the compose message area, inserts card in compose area for all chat windows within teams app

Open sanasz91mdev opened this issue 3 years ago • 7 comments

Describe the bug Node.js Teams botbuilder package: Responding with a card inserted into the compose message area inserts card in compose area for all chats within teams app

sample code

export async function processExtensionSubmit(context: any, action: any) {
    try {
        var cardTemplate = require('../adaptiveCards/submit-ticket-msg-extension.json');
        var member = await Utils.getMemberInfo(context);
        var ticket = new Ticket();
        var ticketResponse = await ticket.submitTickets(action.data, member.email);
        if (ticketResponse.result == true) {
            var parameters: any = {};
            parameters.ticketId = { ticketId: ticketResponse.data.id, title: ticketResponse.data.title, type: action.data.internalCategory == "true" ? "Internal" : "External" };
            const card = Utils.renderAdaptiveCard(cardTemplate, parameters.ticketId);

            //send noti to channel

            await sendNotificationToChannel(context, card);

            //send a composition extension
            return Promise.resolve({
                composeExtension: {
                    attachments: [card],
                    attachmentLayout: "list",
                    type: 'result'
                }
            } as MessagingExtensionActionResponse);
        }
        else {
            return {
                task: {
                    type: "message",
                    value: "Could not process request. An Error occurred."
                }
            } as MessagingExtensionActionResponse;

        }
    } catch (error) {
        console.error(error);
        return ({
            task: {
                type: "message",
                value: "Could not process request. An Error occurred."
            }
        }) as MessagingExtensionActionResponse;
    }
}

Expected behavior Card sent as a Message Extension response with in composeExtension should appear in compose area Only in chat where message extension action was clicked, not in every chat window

Screenshots see how performing a n action via message extension creates a ticket in compose message area of ALL chat windows rather than creating in only the compose area of chat window where message extension action was clicked

4 5 1 3 2
  • OS: Windows 10 Enterprise
  • tool Visual Studio Code
  • Teams app development using BotBuilder package on : Node.js

I reffered the documentation below

Respond with a card inserted into the compose message area The most common way to respond to the composeExtension/submitAction request is with a card inserted into the compose message area. The user submits the card to the conversation. For more information on using cards, see cards and card actions.

Microsoft docs - Build message extensions)**

Is there something wrong with the code? Why is response appearing in compose area of all chat windows? what should i do to get rid of it?

sanasz91mdev avatar Dec 07 '22 11:12 sanasz91mdev

Hi sanasz91mdev! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

ghost avatar Dec 07 '22 11:12 ghost

@sanasz91mdev - We will test this and update you soon.

Nivedipa-MSFT avatar Dec 07 '22 11:12 Nivedipa-MSFT

@sanasz91mdev - We will test this and update you soon.

sure ... i hope the problem is clear? let me know if you need anything else to replicate this.

sanasz91mdev avatar Dec 07 '22 11:12 sanasz91mdev

@sanasz91mdev - We are able to repro your issue and raised the bug for the same. We will let you know once we have any updates on it.

Nivedipa-MSFT avatar Dec 07 '22 11:12 Nivedipa-MSFT

@sanasz91mdev - We are able to repro your issue and raised the bug for the same. We will let you know once we have any updates on it.

@Nivedipa-MSFT is it teams app bug ? will it require teams app update or code changes to my bot? i am planning to roll out the teams bot for my organization.

sanasz91mdev avatar Dec 07 '22 12:12 sanasz91mdev

@sanasz91mdev - This is Teams app bug. After bug fix it will require Teams app update.

Nivedipa-MSFT avatar Dec 08 '22 12:12 Nivedipa-MSFT

@sanasz91mdev - This bug has been fixed now. Could you please update the Teams version to the latest version and check again?

Nivedipa-MSFT avatar Jul 26 '23 09:07 Nivedipa-MSFT