We’re instrumenting the Genesys Cloud Web Messaging SDK (v1.2.0) in our custom chat widget to track customer interaction metrics via New Relic. Everything works fine for text messages, but we’re hitting a wall when customers try to upload files.
The goal is to capture the upload success rate and latency in our NRQL dashboards. We’ve set up a custom event listener on the sendMessage callback to record the transaction duration. However, when a PDF is attached, the client-side SDK throws an error before it even hits our New Relic browser agent’s error collector.
Here’s the relevant snippet from our initialization:
const client = new PureCloudSdk.V2WebMessagingClient({
organizationId: 'our-org-id',
siteId: 'our-site-id',
conversationId: 'current-conversation-id',
onEvent: (event) => {
if (event.type === 'error') {
// Send to New Relic
newrelic.addPageAction('GC_Upload_Error', {
code: event.code,
message: event.message
});
}
}
});
// Attempting to send a file
const file = document.getElementById('fileInput').files[0];
client.sendFile(file).catch(err => console.error(err));
The error object logged is:
{
"code": 415,
"message": "Unsupported Media Type",
"details": "Content-Type 'application/pdf' is not allowed."
}
I’ve checked the Web Messaging configuration in the Genesys Cloud admin UI. The “Allowed file types” field is set to *.* and the max size is 10MB. The PDF is only 200KB.
Is there a specific MIME type whitelist I need to configure in the SDK client options, or is this a known limitation with the guest API endpoint? I can’t find any documentation on overriding the accepted content types in the JavaScript SDK config.
We need this working to get accurate APM data on file transfer failures. Any pointers on the correct config?