Running into a hard stop on file uploads via the Web Messaging SDK. Default limit is 5MB, which is too small for our scanned docs. Tried passing a custom header in the snippet to bump it to 10MB, but the server rejects it.
Code:
ASSIGN headers = {“x-custom-limit”: “10485760”}
ASSIGN res = proxy.Post(“/api/v2/conversations/messages/files”, file, headers)
Returns 413 Payload Too Large. Is there a specific API endpoint or configuration flag to adjust the max size before the upload even starts?
That header approach won’t work because the limit is enforced by the messaging gateway config, not the API call. You need to update the maxFileSize property in your messaging channel via /api/v2/messaging/channels/{id} instead.
The docs state that maxFileSize is just a soft validation threshold. It doesn’t change the underlying storage bucket limits or the gateway’s hard rejection threshold for large payloads. You’ll still get 413 errors if the infrastructure isn’t tuned for it. Updating the channel config is necessary, but it’s not sufficient for files significantly larger than the default.
I usually bypass this by uploading the file directly to an S3 bucket via a pre-signed URL first. The script can generate the URL using a custom integration, then pass the download link to the conversation. It’s more work in the logic, but it avoids the 5MB ceiling entirely. Here’s the flow:
// 1. Get presigned URL from your backend
ASSIGN uploadUrl = proxy.Post("/internal/s3/presign", fileName)
// 2. Upload file directly to S3
ASSIGN proxy.Post(uploadUrl, fileData, {"Content-Type": "application/pdf"})
// 3. Send link to Genesys conversation
ASSIGN message = {
"to": conversationId,
"text": "Please review the attached document: " + uploadUrl
}
proxy.Post("/api/v2/conversations/messages", message)
Channel config update definitely works. Here’s the exact patch payload to bump it to 10MB.
{
"maxFileSize": 10485760
}
Did you check the response headers on that POST? Usually the gateway is rejecting it before it even hits the channel config validation.
If you’re hitting 413 on the upload endpoint itself, it’s likely the reverse proxy or the DFO gateway limit, not just the channel property. The maxFileSize in the channel config is for client-side validation and routing logic. It doesn’t change the infrastructure limit for the upload endpoint.
Try uploading to a pre-signed URL instead. It bypasses the conversation message size limits entirely. Here’s how to get the URL:
import requests
# Get pre-signed URL for upload
url = "https://api.us.genesys.cloud/api/v2/messaging/channels/{channelId}/file-upload-url"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
payload = {
"filename": "scan.pdf",
"contentType": "application/pdf"
}
resp = requests.post(url, json=payload, headers=headers)
upload_url = resp.json()["uploadUrl"]
# Upload file directly to S3
with open("scan.pdf", "rb") as f:
requests.put(upload_url, data=f)
This keeps the file out of the conversation payload size limit. You then reference the file ID in your message.