Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide two new invoke handlers, (message/fetchTask, message/submitAction) for Custom Feedback Loops #6865

Open
jk-msft opened this issue Nov 5, 2024 · 4 comments · May be fixed by #6871
Open
Assignees
Labels
Area: Teams The issue is related to Teams support feature-request A request for new functionality or an enhancement to an existing one.

Comments

@jk-msft
Copy link
Collaborator

jk-msft commented Nov 5, 2024

Overview

We currently allow Bot developers to receive feedback from Teams users using Feedback Loops. When a user clicks "Submit" the feedback, message/submitAction invoke is fired. We need a new invoke handler for message/submitAction invoke.

We are introducing Bot developers to create Custom feedback loops. These custom feedback loops allow Bot developers to show either an Adaptive Card (AC) task module or a website task module. If a bot sent a message with custom feedback loop enabled to the Teams client, the Teams client will fire new invoke, message/fetchTask to determine whether the custom feedback loop should show an AC task module or a website task module. We need another invoke handler for message/fetchTask invoke.

Example Screenshots

Default Feedback

Image

Custom Feedback (AC)

Image

Custom Feedback (Website)

Image

Return Values

How I am currently handling these two invokes inside onInvokeActivity

message/submitAction

{
  status: 200,
  body: {}
}

message/fetchTask

Adaptive Card

const taskModuleReturn = {  
  task: {  
    type: 'continue',  
    value: {  
      card: [Object], // Should contain valid Adaptive Card Payload 
      height: 200,  
      width: 400,  
      title: 'Test Task Module Title with AC'  
    }  
  }  
};
return {
  status: 200,
  body: taskModuleReturn
};

Website URL

const taskModuleReturn = {  
  task: {  
    type: 'continue',  
    value: {  
      url: "https://bing.com", // Should contain valid URL with the valid domain listed under App Manifest
    }  
  }  
};
return {
  status: 200,
  body: taskModuleReturn
};

Sample Bot Code

Send messages with feedback loop

    this.onMessage(async (context, next) => {
      console.log("Running with Message Activity.");
      const removedMentionText = TurnContext.removeRecipientMention(context.activity);
      const txt = removedMentionText.toLowerCase().replace(/\n|\r/g, "").trim();
      await context.sendActivity(`Echo: ${txt}`);
      await context.sendActivity({
        type: ActivityTypes.Message,
        text: "Old message with feedbackLoopEnabled = true",
        channelData: {
          feedbackLoopEnabled: true // use default feedback form
        },
      });
      await context.sendActivity({
        type: ActivityTypes.Message,
        text: "Old message with feedbackLoopEnabled = false",
        channelData: {
          feedbackLoopEnabled: false // use default feedback form
        },
      });
      await context.sendActivity({
        type: ActivityTypes.Message,
        text: "new message with feedbackLoop = default",
        channelData: {
          feedbackLoop: {
            type: "default"
          }
        },
      });
      await context.sendActivity({
        type: ActivityTypes.Message,
        text: "new message with feedbackLoop = custom",
        channelData: {
          feedbackLoop: {
            type: "custom"
          }
        },
      });
      // By calling next() you ensure that the next BotHandler is run.
      await next();
    });
@jk-msft jk-msft added feature-request A request for new functionality or an enhancement to an existing one. needs-triage The issue has just been created and it has not been reviewed by the team. labels Nov 5, 2024
@jk-msft
Copy link
Collaborator Author

jk-msft commented Nov 5, 2024

@tracyboehrer tracyboehrer added Area: Teams The issue is related to Teams support and removed needs-triage The issue has just been created and it has not been reviewed by the team. labels Nov 5, 2024
@tracyboehrer
Copy link
Member

tracyboehrer commented Nov 5, 2024

@ceciliaavila Write a sample for this to test with too. You'll need to test on a specific Teams version that jk-msft can help with if needed.

@sw-joelmut
Copy link
Collaborator

Hi @jk-msft,

We are implementing this feature and wanted to know if we would require targeting a specific endpoint or Teams version for testing. If this is the case, can you share it with us?

Thanks!

@jk-msft
Copy link
Collaborator Author

jk-msft commented Nov 15, 2024

Hi @sw-joelmut , can you find me in Teams? [email protected]
I'll share the details with you internally.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Teams The issue is related to Teams support feature-request A request for new functionality or an enhancement to an existing one.
Projects
None yet
4 participants