CXone Messenger SDK - custom CSS properties stripped on conversation lifecycle event

Hi all,

The JavaScript messenger SDK is failing to maintain custom CSS overrides during the transition from a pre-chat state to an active conversation. Specifically, the deployment snippet applies a specific border-radius and brand-color to the widget container, but these properties are stripped the moment the conversation lifecycle event triggers the handoff to a live agent.

This behavior is inconsistent with several community posts regarding widget persistence. The style is active during the initial load but disappears upon agent connection. We’re on NICE CXone and the issue is affecting all browser sessions in our staging environment.

The console shows a 400 Bad Request when the SDK attempts to refresh the UI state:

{
 "error": "InvalidRequest",
 "message": "The requested CSS property override is not permitted for the current session state.",
 "code": 400,
 "timestamp": "2023-10-27T14:22:01Z"
}

Attempts to force the styles via a MutationObserver in the deployment snippet didn’t work as the SDK keeps overwriting the DOM elements. The customization API calls for the theme are returning 200 OK, but the actual render is ignoring the payload once the agent joins.

The SDK is notorious for resetting the DOM on state changes. Stop relying on the deployment snippet for styles. Just force a CSS override in your global stylesheet using !important on the CONTAINER_ID.

.cxone-messenger-container {
 border-radius: 12px !important;
 --brand-color: #ff0000 !important;
}

Fastest way to kill this bug.

1 Like

are you using the standard messenger snippet or a custom implementation?

cause:
the sdk rebuilds the dom tree during the state transition to clear out pre-chat variables. it’s basically a fresh render, so any styles applied to the previous element are lost because that element literally doesn’t exist anymore.

solution:
the fix above is spot on. i’m four coffees into debugging a similar ui glitch and found that targeting the parent wrapper with !important is the only way to beat the sdk’s inline style injection.

.cxone-messenger-container {
 border-radius: 12px !important;
 background-color: #ff0000 !important;
}