We need to pass the CRM customer ID directly into the Web Messaging SDK startChat() call so we can correlate the session with New Relic custom events. The docs show startChat accepts an options object, but passing data: { crmId: '123' } doesn’t seem to persist to the webhook payload.
messagingWidget.startChat({
data: {
crmId: 'CUST-998877'
}
});
The webhook only returns standard fields. Is there a specific key or endpoint I’m missing to attach this metadata at initialization?
The data object in startChat usually maps to custom attributes, but it often gets stripped or renamed depending on your webchat configuration in Genesys Cloud. If you need it in the webhook payload for New Relic, you might need to use setUserData before starting the chat, or ensure the attribute is mapped in the Engagement settings.
// Try setting user data explicitly
messagingWidget.setUserData({
attributes: {
crmId: 'CUST-998877'
}
});
// Then start
messagingWidget.startChat();
Check your Web Chat configuration under Engagement > Web Chat > Custom Attributes. If the attribute isn’t listed there, the system won’t pass it through to the webhook. Also, verify the webhook payload structure in the Architect flow. Sometimes the data ends up in engagement.attributes instead of the root. I’ve seen this issue where the SDK sends it, but Genesys drops it because it’s not whitelisted.