We are integrating the Genesys Cloud Web Messaging widget into a React portal. The requirement is to pass custom guest attributes, specifically a customer_id and account_tier, when the user is logged into our app. When the user logs out of our app, we want those attributes cleared so the next interaction is treated as a fresh anonymous guest.
The issue is that even after we call widget.clearSession() and reload the page, the previous customer_id still appears in the PureCloud interaction history. It seems the guest context is sticking around in the browser storage or the widget’s internal state.
Here is the initialization code we are using:
import { Widget } from '@genesys/web-messaging-sdk';
const widget = new Widget({
orgGuid: 'our-org-guid',
deploymentGuid: 'our-deployment-guid',
guestAttributes: {
customer_id: user.id,
account_tier: user.tier
}
});
widget.init();
On logout, we run this sequence:
widget.clearSession();
// Then we unmount the React component containing the widget
We also tried setting the guestAttributes to null or an empty object before clearing the session, but it didn’t help. The next time the user logs in with a different account, the old customer_id is still attached to the new conversation.
We checked the network tab. The POST /api/v2/conversations/messaging request includes the old attributes in the attributes payload. The HTTP 200 response confirms the conversation was created with the stale data.
Is there a specific method to wipe the guest identity completely? Or do we need to manipulate the genesys.cloud storage keys manually? We want to avoid hardcoding storage key names in case they change in future SDK versions. Any advice on the correct lifecycle hook to reset this state would be appreciated.