Setting custom attributes via GenesysCloudWebMessaging.setGuestInfo before createSession works for anonymous guests, but the attributes vanish or get overwritten when we switch to authenticated flows using the login method. The goal is to pass user-specific metadata (like crmId and department) that survives the session creation.
Here’s the initialization sequence:
const widget = GenesysCloudWebMessaging.init({
appId: 'abc-123',
region: 'mypurecloud.com'
});
widget.setGuestInfo({
firstName: 'Dev',
lastName: 'User',
email: 'dev@example.com',
customAttributes: {
crmId: 'C-999',
department: 'Engineering'
}
});
// Authenticated flow
widget.login('user-token-xyz').then(() => {
return widget.createSession({
routing: {
queueId: 'queue-uuid'
}
});
});
The createSession call succeeds with a 201 status. However, checking the conversation history in the admin UI shows the guest details as Anonymous or missing the custom attributes entirely. The customAttributes object is present in the initial payload logged by the SDK console but doesn’t appear in the /api/v2/conversations/messages/{id} response.
Is there a specific step to merge the guest info with the authenticated user profile, or does the login method reset the guest context? The docs for setGuestInfo imply it applies to the current session, but the behavior suggests otherwise when a token is involved. We’ve tried calling setGuestInfo after login but before createSession, but that throws a 409 Conflict error saying the guest is already set. Any pointers on the correct sequence or a missing flag in the session config?