Trying to pass custom guest attributes for authenticated users when the Web Messaging widget loads. The docs say to set them in the onInit callback, but they’re showing up as null in the engagement object.
Here’s the setup:
const onInit = (api) => {
api.setGuestAttributes({
'crmId': user.crmId,
'userId': user.id
});
api.init({
deploymentId: 'xxx',
organizationId: 'yyy'
});
};
The widget renders fine. No console errors. But when I pull the engagement via /api/v2/engagements/webchat or check the transcript, those attributes are missing. I’ve verified the user object has data before setGuestAttributes is called. Is there a race condition between init and setGuestAttributes? Or is the API expecting a different payload structure for authenticated guests?