I am creating a message extension in Microsoft teams and I am running into some issues with chaining task modules from the CommandBar (This is the important part)
I have 2 task modules, A and B.
The Goal: Run a command from the CommandBar that will respond with task module A. On submitting the task module the message extension should respond task module B.
The issue: I can't work out how to respond with a task module from inside the onSubmitAction function (on the message extension implementing IMessagingExtensionMiddlewareProcessor.
Here is a cut down version of my code:
export default class HelpDeskMessageExtension implements IMessagingExtensionMiddlewareProcessor {
public async onFetchTask(): Promise<MessagingExtensionResult | TaskModuleContinueResponse | TaskModuleMessageResponse> {
return Promise.resolve<TaskModuleContinueResponse>({
type: "continue",
value: {
url: `${process.env.HostName}/helpdesk.html`,
width: 500,
height: 500,
},
});
}
public async onSubmitAction(context: TurnContext): Promise<any> {
//TODO: If this submit came from task module A, respond with Task module B
// If this came from task module B, respond with a success card
const heroCard = CardFactory.heroCard('<span style="color: green">Message successfully sent</span>',);
await context.sendActivity({ attachments: [heroCard] });
}
}
Note: This works fine when using the message extension from the compose box. The issue is running this extension from the CommandBar
Any help would be greatly appreciated.