Trying to pass a CRM customer ID from our web portal into the CXone Web Messaging SDK so it’s available in the script. The goal is simple: attach the ID to the session, read it in and use it for routing.
I’m using the startChat() method with the attributes object. The code looks standard:
NICECXoneWebMessaging.startChat({
attributes: {
crmId: 'CUST-998877',
source: 'web-portal'
}
});
The chat starts fine. The widget loads. But when I check the interaction data in the crmId attribute is missing. I’ve tried adding it via setAttributes() before startChat(), but that throws a state error saying the session isn’t active yet.
Here’s what I’ve checked:
- The SDK version is 2.1.4. No console errors on load.
- The script has a
GetRESTProxyaction to dump session data. ThecrmIdkey never shows up in the response. - I tried passing the ID in the
labelsobject instead ofattributes. Labels show up in the admin console, but still can’t see them as custom attributes. - Verified the OAuth token used by the SDK has the right scopes. It does.
The documentation says attributes are passed to the backend. They clearly aren’t making it to the context. Is there a specific prefix required for custom attributes? Or is the startChat() API deprecated for this use case?
I need this ID in before the agent accepts the chat. Right now, I’m stuck.