I have this code that works yesterday. Its simple request for a video file upload, validate if the file is in a video format and then save it.
The prompt for video is
var promptOptions = {
prompt: 'Upload a video',
retryPrompt: 'The attachment must be a video file.'
};
return await step.prompt(VID_PROMPT, promptOptions);
where VID_PROMPT is an AttachmentPrompt:
this.addDialog(new AttachmentPrompt(VID_PROMPT, this.videoValidator));
and the validator, videoValidator's code is:
async videoValidator(promptContext) {
//for back end cheking
console.log("\n\r Message Type:" + promptContext.context._activity.type);
console.log("\n\r Message:" + JSON.stringify(promptContext.context._activity.channelData.message));
/***************************/
if (promptContext.recognized.succeeded) {
var attachments = promptContext.recognized.value;
var validImages = [];
attachments.forEach(attachment => {
if (attachment.contentType === 'video/mp4' || attachment.contentType === 'video/x-msvideo' || attachment.contentType === 'video/mpeg' || attachment.contentType === 'video/3gpp' || attachment.contentType === 'video/3gpp2') {
validImages.push(attachment);
}
});
promptContext.recognized.value = validImages;
// If none of the attachments are valid videos, the retry prompt should be sent.
return !!validImages.length;
}
else {
await promptContext.context.sendActivity('No attachments received. Please attach video file.');
return false;
}
}
Again, this worked fine yesterday (with the same code) but today, whenever I upload a video:
It would prompt No attachments received. Please attach video file from my validator So I looked in the back and saw this:
Which says that the message received is doesn't contain an attachment, and of course AttachmentPrompt will see this and promptContext.recognized.succeeded will be false thus executing the else clause in my videoValidator.
Now, I tried uploading a picture, just to check if it would recognize an attachment file type:
And the message The attachment must be a video file. shows when it recognize I uploaded an attachment but the file type isn't video. And this is the back data:
How do I fix this. I didn't change anything,just suddenly didn't work. Please help. Thanks!
PS. I use botbuilder 4.11.0.
UPDATE: I checked directline channel and its working fine. It just doesn't work on Facebook channel I guess?
UPDATE: Now, even images aren't recognized as attachments :(
This issue is related to FB webhooks (and is now working) see this thread: https://developers.facebook.com/support/bugs/393441492018560/