microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.6k stars 1.55k forks source link

User uploading (large) attachments: Is WEB_CHAT/SEND_FILES still dispatched? #5264

Closed HesselWellema closed 3 months ago

HesselWellema commented 3 months ago

Is it an issue related to Adaptive Cards?

No

Is this an accessibility issue?

No

What version of Web Chat are you using?

Latest production

Which distribution are you using Web Chat from?

Bundle (webchat.js)

Which hosting environment does this issue primarily affect?

Web apps

Which browsers and platforms do the issue happened?

Browser: Edge (latest)

Which area does this issue affect?

Send box

Which theme pack does this issue affect?

I did not test it on other theme packs

What is the public URL for the website?

No response

Please describe the bug

Hi team

I am trying to implement a solution to allow users to upload large attachments. I am following this sample and need to capture WEB_CHAT/SEND_FILES in my store. I checked all action types that are dispatched but WEB_CHAT/SEND_FILES is not one of them.

I have three questions:

.1 Is this action type still dispatched if the attachments are send via DirectLine .2 If not, I there a workaround that you guys suggest .3 If not, then I will use the default way to upload attachments. This has a good UI. I would like to check for the filesize however and send a message to the user if the filesize exceeds 4MB. How do I send a message to thes user from within webchat?

thank you

Do you see any errors in console log?

Not relevant

How to reproduce the issue?

Implement a store in webchat.

Step 1

const storeMiddleware = store => next => action => {
 if (action.type === 'WEB_CHAT/SEND_FILES') {
        console.log('We got him!')
      }

Step 2 Send one or more attachments to the bot

Step 3 Watch the console. Nothing there

What do you expect?

I would like to be able to capture an event or action type that would allow me to manipulate the attachments. I already have functionality in place to upload the attachments to a azure container and have the bot get the attaachments from there

What actually happened?

There is no WEB_CHAT/SEND_FILES to use

Do you have any screenshots or recordings to repro the issue?

No response

Adaptive Card JSON

No response

Additional context

No response

HesselWellema commented 3 months ago

Closed. Solved it like this:

     else if (action.type === 'DIRECT_LINE/POST_ACTIVITY') {
        const { activity } = action.payload;
        if (activity && activity.attachments && activity.attachments.length > 0) {
}