aws-lex-web-ui icon indicating copy to clipboard operation
aws-lex-web-ui copied to clipboard

File/photo upload

Open jounih opened this issue 7 years ago • 9 comments

In addition to the default Lex slot types, would it be possible to do add a custom step on the chat bot - for instance, request a user to upload a file or photo (and store it on S3), then return to the Lex flow?

jounih avatar Jan 15 '18 17:01 jounih

Hello,

This may be possible by embedding the Lex Web UI as an iframe and using the iframe API. In this scenario, the parent page hosting the iframe would be monitoring the Lex state updates to know when to prompt the user to upload the file (e.g. based on intent, dialogState or sessionAttribute).

Once the file has been uploaded, the upload function in the parent page would call the postText iframe API function (either function or event) to send an utterance signaling that the file has been uploaded. The utterance can include a link that the bot can use to fill a slot or use in a Lambda hook.

Hope this helps. Let me know if you have further questions or comments.

-- Oliver

atoa avatar Jan 16 '18 15:01 atoa

Any option to implement it from the console?

dileephell avatar Mar 26 '18 04:03 dileephell

this is now possible (almost) with the new markdown feature!

with a markdown answer you can embedd an html tag and this will give a upload button in the bot response.

however, you will need to write a js handler for that. I did this in a project using the vue component and wrote a delegated handler to handle the file upload.

JohnCalhoun avatar Jun 15 '18 13:06 JohnCalhoun

@JohnCalhoun - can you give an example on how you used the markdown feature? Are there any open sourced examples available?

analyticsbot avatar Jul 03 '18 22:07 analyticsbot

Hi guys - any examples on how to achieve this?

scottharman avatar Feb 17 '19 20:02 scottharman

@JohnCalhoun is there a chance you could share an example of that code? Looking for a way to upload a data (or .txt) file to a chat window.

Ruzard avatar Apr 15 '19 23:04 Ruzard

@Ruzard I know it's bit late, but is there any chance you have found a workaround for that? Please share if you do. Thanks.

HarshaKumarKS avatar Oct 09 '20 14:10 HarshaKumarKS

@JohnCalhoun any code update on this?

debansheesaha avatar Jul 15 '21 14:07 debansheesaha

I believe it's doable. Couple of approaches came to my mind. If your application interacting with Lex via AWS SDK (such as boto3) then you can give permission to same boto3.client to access (s3) and throw the file there. See how boto3 with Django are doing it

Second approach is via Lambda function. Let lex invoke Lambda function responsible for communicating with AWS SDK to take the file and put it inside a predefined bucket

I've configured Django to put files in S3 and in separate project, I integrated Telegram with Lex So I believe it's doable

yalattas avatar Oct 02 '21 18:10 yalattas