Web Messaging SDK: Handling file upload MIME validation and size limits

The @genesyscloud/web-messaging-widget-sdk doesn’t expose a direct hook for MIME type validation or file size limits before the upload starts. I tried intercepting the fileUploaded event, but by then the blob is already sent to the API.

const config = {
 allowFileUpload: true,
 // No maxSize or acceptedTypes property here
};

How do I enforce these constraints client-side without hacking the widget CSS? I need to block the user before they trigger the POST to /api/v2/conversations/messaging/messages.

The SDK doesn’t validate MIME types client-side, so you’ll need to intercept the file selection event in your custom widget code before it hits the upload endpoint. Just check the file’s type property against your allowed list and reject it there.