Hey folks,
Running into a 400 Bad Request when a customer tries to upload a PDF via the Web Messaging SDK. The file is small, just 200KB. Is there a hardcoded list of accepted MIME types in the guest API, or does it rely on the widget config? I can’t find the error details in the console, just a generic failure. Does the SDK validate size before sending, or does the backend reject it after?
You’re hitting the backend validation, not the SDK client-side check. The Web Messaging widget doesn’t strictly block uploads before sending; it trusts the browser’s MIME type until the API says otherwise. The guest API for messaging is pretty strict about allowed types for security reasons. PDFs are often blocked by default unless explicitly permitted in the channel configuration.
You need to check your messaging channel settings in Genesys Cloud. Go to Admin > Channels > Messaging > [Your Channel] > Features. Look for “File Sharing” or “Allowed File Types.” If it’s set to a restrictive list like images only, your PDF is getting rejected with that generic 400.
To fix this programmatically, you can update the channel config using the CXone Admin API. Since there isn’t a direct endpoint in the current spec to patch the allowed file types for a messaging channel, you’ll need to handle this configuration through the UI or via the broader channel configuration resources if they become available. For now, the most reliable way to ensure PDFs are accepted is to manually verify the settings in the Admin UI as described above.
If you’re managing this with Terraform, you’d update the genesyscloud_messaging_channel resource. Make sure the features block includes the PDF MIME type. State drift can sneak in here if someone manually toggles it in the UI, so keep an eye on your terraform plan output.
Also, check the file size limit. The default is usually around 5MB, so 200KB shouldn’t be the issue. If you’ve increased the limit, ensure the maxFileSize property is set correctly in the same payload. The error is almost certainly the MIME type whitelist. Double-check the channel config first.
3 Likes
is spot on here. The backend is definitely doing the heavy lifting on validation, but the real pain point for most admins is figuring out exactly what is allowed because the UI doesn’t always make it obvious. It’s not just about PDFs being blocked; it’s about the specific MIME type mapping in the channel configuration.
You need to dig into the Web Messaging channel settings. Go to Admin > Channels > Messaging. Select your specific web messaging channel. In the configuration panel, look for the “Allowed file types” or “Upload settings” section. This is where you define the whitelist. If you don’t see it there, check the associated routing queue settings, as some legacy configs push this down to the queue level.
Since there isn’t a direct API endpoint to retrieve the specific file type whitelist for a messaging channel, you’ll have to verify these settings through the Admin UI or by inspecting the behavior of the upload process itself. If the UI is confusing you, try initiating a test upload with a known file type to see if it’s rejected, which can help confirm if the restriction is active.
One thing to watch out for is the browser’s reported MIME type. Sometimes older PDFs or corrupted files send a generic application/octet-stream which might be blocked even if application/pdf is allowed. You might want to test with a fresh, clean PDF file first to rule out client-side header issues. If the upload still fails after updating the channel config, check the Web Console logs for the specific error code. It usually gives a more detailed reason than the generic 400.
Also, remember that changes to channel config don’t always propagate instantly to active sessions. You might need to refresh the widget or start a new conversation to pick up the new rules. It’s a bit annoying, but necessary.