I'm calling microsoftTeams.tasks.submitTask() with some data from my Embedded Web View Task module like this:
var fsObj = {};
fsObj.name = "give me a file";
microsoftTeams.tasks.submitTask(fsObj);
This then arrives at my bot with the data and invokes the onTeamsMessagingExtensionSubmitAction event, which I've handled like this:
@Override
protected CompletableFuture<MessagingExtensionActionResponse> onTeamsMessagingExtensionSubmitAction(TurnContext turnContext, MessagingExtensionAction action) {
File filePath = new File("files", "10840-002.pdf");
String filename = filePath.getName();
long filesize = filePath.length();
Map<String, String> consentContext = new HashMap<>();
consentContext.put("filename", filename);
FileConsentCard fileCard = new FileConsentCard();
fileCard.setDescription("Here is a file...");
fileCard.setSizeInBytes(filesize);
fileCard.setAcceptContext(consentContext);
fileCard.setDeclineContext(consentContext);
MessagingExtensionAttachment asAttachment = new MessagingExtensionAttachment();
asAttachment.setContent(fileCard);
asAttachment.setContentType(FileConsentCard.CONTENT_TYPE);
asAttachment.setName(filename);
MessagingExtensionResult msgExtRes = new MessagingExtensionResult();
msgExtRes.setType("result");
msgExtRes.setAttachmentLayout("list");
msgExtRes.setAttachment(asAttachment);
MessagingExtensionActionResponse actionResponse = new MessagingExtensionActionResponse();
actionResponse.setComposeExtension(msgExtRes);
return CompletableFuture.completedFuture(actionResponse);
}
This code runs, and my embedded web view Task Module then closes, but I do not see the file consent message in the chat.
I have successfully duplicated this File Upload bot example, where I'm able to get a file through when talking directly to my bot.
Is it possible to respond to the submit action invoked in my embedded web view with a FileConsentCard? If so, what am I missing in my response?