Open atymic opened 9 months ago
Hi atymic! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.
Best regards, Teams Platform
Hii @atymic we are investigating the issue and get back to you soon.
Hello @atymic Could you please refer this sample - https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/c173c0e7a316df7425db1d795713e46c00594632/samples/bot-sharepoint-file-viewer/nodejs/bots/dialogBot.js#L64
Hi @Vikram-MSFT Returning null also gives an error on teams, saying the response is invalid
Hello @atymic - Could you please share the complete code snippets that you are trying from your end?
Works:
return {
statusCode: 200,
task: {
type: 'message',
value: 'SMS Sent successfully! You can close this dialog'
}
}
Does not work
return {
statusCode: 200,
}
return null
return {
statusCode: 200,
task: null
}
return {
statusCode: 200,
task: {
type: 'message',
value: null
}
}
return {
statusCode: 200,
task: {
type: 'InvokeResponse',
value: null
}
}
Hello @atymic To close a task module from a bot in Node.js, you can use the following code snippet: const response = { task: { type: 'message', value: 'Task module dismissed' } }; await turnContext.sendActivity({ value: response, type: 'invokeResponse' }); This will send an invokeResponse activity to the client, which will close the task module and display the message "Task module dismissed".
@atymic - You can call submitTask() without any parameters if you want Teams to close the dialog. Ref Doc: https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/task-modules/task-modules-bots?tabs=nodejs#submit-the-result-of-a-dialog
See the issue https://github.com/MicrosoftDocs/msteams-docs/issues/832 It provides the way to do it for c# (
turnContext.SendActivityAsync(new Activity { Value = null, Type = ActivityTypesEx.InvokeResponse });
) How can we do this in node?