Task Module fetch and submit not working in typescript bot SDK4

Viewed 313

I have developed a bot using botframework sdk4 in typescript and deployed it to ms teams. I am facing an issue in fetching the task module. I am sending the invoke activity from the hero card using the below method.

getHeroCardMenu() {
    return CardFactory.heroCard('Task Module Invocation from Hero Card',
        'This is a hero card with a Task Module Action button.  Click the button to show an Adaptive Card within a Task Module.',
        null, // No images
        [{ type: 'invoke', title: 'Task Module', value: { type: 'task/fetch', data: 'adaptivecard' } }]);
}

The above method is sending the invoke activity perfectly to the activity handler - handleTeamsTaskModuleFetch(context, taskModuleRequest) in the method below

async handleTeamsTaskModuleFetch(context, taskModuleRequest): Promise<TaskModuleResponse>{
    // taskModuleRequest.data can be checked to determine different paths.
    console.log(taskModuleRequest.data) // output received - { type: 'task/fetch', data: 'adaptivecard' }
    return {
        task: {
            type: 'continue',
            value: {
                url: 'https://www.google.com',
                height: 600,
                width: 800,
                title: 'Adaptive Card: Inputs'
            }
        }
    };
}

Now the issue is that when I compile the code I am getting the following error Error received in the terminal

What I have understood from the error is that, it is not letting me set the 'type': to either 'continue' or 'message' which is very strange. I have taken this sample code from https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/54.teams-task-module which the Nodejs version of the code. I have looked all around to find an implementation of task modules in typescript sdk4 but could only find the node js version which is throwing this error. Please suggest some solution if anyone has been able to use task modules with typescript in botframework sdk4.

thanks in advance

0 Answers
Related