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

Unable to trigger a task module from onSubmitAction #11

Open
meduck opened this issue Mar 8, 2021 · 0 comments
Open

Unable to trigger a task module from onSubmitAction #11

meduck opened this issue Mar 8, 2021 · 0 comments

Comments

@meduck
Copy link

meduck commented Mar 8, 2021

I was trying to trigger a task module from inside the onSubmitAction function (implemented from IMessagingExtensionMiddlewareProcessor) but it will always fail with an error. I trigger this from the command bar (this is the important bit)

I found that MessagingExtensionMiddleware.onTurn will always return the response of the onSubmitAction as the value of a composeExtension property which can be seen here:

index - line 267

switch(...)
...
   default:
     result = yield this.processor.onSubmitAction(context, context.activity.value);
      body = {
          composeExtension: result,
      };
  break;
}
context.sendActivity({
  type: INVOKERESPONSE,
  value: {
      body,
      status: 200,
  },
});

If I change the composeExtension to task then it works fine.

Am I doing something wrong or is there no way to call another task module? Here is a cutdown of my code (this code would work if I done the above change of updating composeExtension to task)

export default class HelpDeskMessageExtension implements IMessagingExtensionMiddlewareProcessor {

    public async onFetchTask(): Promise<MessagingExtensionResult | TaskModuleContinueResponse | TaskModuleMessageResponse> {
        return Promise.resolve<TaskModuleContinueResponse>({
            type: "continue",
            value: {
                url: `${process.env.HostName}/action.html`,
            },
        });
    }


    public async onSubmitAction(context: TurnContext): Promise<MessagingExtensionResult> {
        return Promise.resolve<MessagingExtensionResult>({
            type: "continue",
            value: {
                card: CardFactory.adaptiveCard({
                    type: 'AdaptiveCard',
                    body: [{type: 'TextBlock', text: "text"}],
                    actions: [{type: 'Action.Submit', title: 'Ok', data: {endFlow: true }}],
                })
            }
        });
    }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant