Web Messaging Guest API: Handling large file uploads and MIME type validation

We’re building a custom agent desktop wrapper around the Web Messaging Guest API, and I’m running into some silent failures when customers try to attach files. The sendAttachment method in the SDK seems to accept the request without throwing an immediate JavaScript error, but the file never appears in the conversation for the agent, and there’s no obvious error callback.

I’ve been logging the payload before it hits the API. Here’s a snippet of what we’re sending for a PDF under 2MB:

const fileInput = document.getElementById('file-upload');
const file = fileInput.files[0];

// Check MIME type manually
if (!['application/pdf', 'image/png', 'image/jpeg'].includes(file.type)) {
 console.warn('Unsupported MIME type:', file.type);
 return;
}

// Check size limit (5MB max)
if (file.size > 5 * 1024 * 1024) {
 console.warn('File too large:', file.size);
 return;
}

// Convert to base64
const reader = new FileReader();
reader.onload = async () => {
 const base64String = reader.result.split(',')[1];
 
 try {
 await guestSession.sendAttachment({
 type: 'file',
 name: file.name,
 mimeType: file.type,
 content: base64String
 });
 console.log('Attachment sent successfully');
 } catch (error) {
 console.error('Failed to send attachment:', error);
 }
};
reader.readAsDataURL(file);

The issue is that when we test with a PNG image that’s exactly 4.9MB, it works. But with a 5.1MB image, the request completes without error, yet the attachment doesn’t show up. I’ve checked the network tab, and the POST to /api/v2/conversations/{conversationId}/messages returns a 200 OK. However, if I look at the response body, the attachments array is empty.

I’ve also noticed that certain MIME types like application/vnd.openxmlformats-officedocument.wordprocessingml.document (docx) are being rejected silently. Is there a definitive list of accepted MIME types for the Guest API? And is the 5MB limit strictly enforced on the base64 encoded string or the original file size? The documentation is vague on this.

I’ve tried catching errors in the catch block, but nothing is thrown. I’ve also tried reducing the file size incrementally to find the exact cutoff, and it seems like anything over 5MB gets ignored. But I need to know if this is a hard limit or if there’s a configuration on the Web Messaging instance that changes this.

Also, is there a way to validate the MIME type server-side before sending? Right now, we’re doing client-side validation, which feels fragile. Any insights on how to handle this more robustly?