wictorwilen/botbuilder-teams-messagingextensions

botMessagePreview functionality does not work completely

Closed this issue · 1 comments

I'm using the messaging extension middleware to create an action-based command which displays an adaptive card within the task module. The adaptive card has a submit action which triggers the onSubmitAction function. From there I'm using the botMessagePreview type in the response. All this works fine but the issue arises when handling submit actions from the Edit and Submit buttons from the botMessagePreview task module. When the Edit submit action is triggered, onSubmitAction is run and I want to send the original task module back to the teams client. However for that to work the return value has to be of type TaskModuleContinueResponse but the function and the middleware does not handle that case.

I figured out that the issue is because of the composeExtension in the activity being sent on line 244:

case "composeExtension/submitAction":
if ((this.commandId === context.activity.value.commandId || this.commandId === undefined) &&
this.processor.onSubmitAction) {
try {
const result = await this.processor.onSubmitAction(context, context.activity.value);
context.sendActivity({
type: INVOKERESPONSE,
value: {
body: {
composeExtension: result,
},
status: 200,
},
});

A similar issue also shows up when the Submit action is triggered but I'm currently working around it by calling sendActivity from the onSubmitAction function itself.

Here's the doc detailing the botMessagePreview functionality.

The botMessagePreview functionality is cruicial to the application I'm currently building and I would appreciate it if it can be resolved as soon as possible. Also, I can create a PR for this but before that I wanted to know your thoughts on this.

Thanks for this. I'd love to improve/add the support for this. Feel free to create a PR and we'll look into how it works and how we can support a smooth upgrade for existing solutions.

Thanks