Passing CRM ID in Genesys Web Messaging SDK startChat()

I’m building a custom wrapper around the Genesys Web Messaging SDK and need to pass a CRM customer ID into the startChat() method. The docs suggest using customAttributes, but the payload doesn’t seem to reach the architect flow.

await client.startChat({
 customAttributes: { crmId: '12345' }
});

The chat connects, but the attribute is missing in the contact attributes. Am I using the wrong key?

The issue is likely that you’re sending crmId as a string, but Genesys Web Messaging expects custom attributes to be explicitly typed. The SDK is pretty strict about this. If you don’t specify the type, it often gets dropped or ignored during the handoff to the Architect flow.

Try wrapping it in an object with the type property. Here’s how that should look:

await client.startChat({
 customAttributes: {
 crmId: {
 value: '12345',
 type: 'text'
 }
 }
});

Once you do that, the attribute should show up in the contact attributes section of your Architect flow. You can then use it in a Get Data step or pass it to a script.

Also, double-check that your web messaging channel isn’t stripping custom attributes in the org settings. It’s a rare config, but it happens. If the above doesn’t work, check the network tab in your browser dev tools. Look for the POST /webchat/v1/organizations/{orgId}/conversations request. The payload should contain the customAttributes object exactly as you defined it. If it’s missing there, the SDK isn’t sending it. If it’s there but not in Architect, the typing was the issue.

Custom attributes in Web Messaging are tricky. Try setting them via setCustomerAttributes before calling startChat. It’s more reliable than passing them in the init object.