I’m trying to pass a CRM customer ID into the CXone Web Messaging session via the SDK. The goal is to have the crmId available on the contact object immediately when the agent picks up the chat.
I’ve got the SDK loaded and initialized. Here is the initialization code:
window.cxoneWebMessaging = window.cxoneWebMessaging || [];
window.cxoneWebMessaging.push(['init', {
"appId": "my-app-id",
"orgId": "my-org-id",
"launcherStyle": "classic"
}]);
Then, when the user clicks a button on our site, I call startChat with the guestAttributes object:
window.cxoneWebMessaging.push(['startChat', {
"guestAttributes": {
"crmId": "CUST-998877",
"source": "website-header"
}
}]);
The chat window opens fine. No console errors. But when I look at the contact in the CXone admin console or check the webhook payload for chat.start, the crmId is missing. The source attribute also isn’t there. I see the standard userId and orgId in the payload, but nothing from my guestAttributes block.
I’ve tried moving the guestAttributes inside the init call instead of startChat, but that didn’t work either. The docs say startChat accepts this object. Is there a specific format required? Or does the SDK strip custom attributes unless they’re pre-defined in the flow?
Here is the JSON payload I’m seeing in the webhook:
{
"contactId": "abc-123",
"userId": "web-guest-xyz",
"orgId": "my-org-id",
"timestamp": "2023-10-27T10:00:00Z"
}
Nothing about the CRM ID. I’ve checked the network tab and the request to /api/v2/conversations/webmessaging goes through with a 200 OK. The body of that request doesn’t seem to include the custom attributes either.
What am I missing?