Trying to pass custom guest attributes to the Genesys Cloud Web Messaging widget for authenticated users. The goal is simple. We have a login flow in our app. Once the user logs in, we want to attach their external_user_id and membership_tier to the chat session so our agents can see it immediately. No SSO bridge needed here. Just standard guest attribution.
I’m using the standard JavaScript SDK initialization. Docs state: “Custom attributes can be set via the setGuestAttributes method on the widget instance.” Here’s the relevant snippet:
genesysCloudWebMessaging.init({
orgUuid: "my-org-uuid",
deploymentId: "my-deployment-id",
});
// After user login
const guestAttributes = {
external_user_id: "usr_12345",
membership_tier: "gold"
};
genesysCloudWebMessaging.setGuestAttributes(guestAttributes);
The widget loads fine. The conversation starts. But when I check the conversation details via the API or look at the agent view, these attributes are missing. I’m not getting a console error in the browser. The setGuestAttributes call doesn’t throw. It just… does nothing.
Wait. I added a fetch interceptor to log network calls. I see a PATCH request to /api/v2/conversations/webmessaging/guests/{guestId}/attributes. It returns a 400 Bad Request. The response body is empty. No error message. Just a 400.
Is the JSON structure wrong? The docs show a simple key-value object. I’m sending exactly that. I’ve tried wrapping it in a data object. I’ve tried sending it as a query param. Nothing works. The 400 persists.
Is there a specific format required for the attribute keys? Maybe they need to be prefixed? Or is the guestId being used in the PATCH request invalid at that point in the lifecycle? The widget seems to generate a guest ID before the conversation is fully established.
Running out of ideas. The documentation is sparse on error handling for this specific method. Can anyone confirm the exact payload shape expected by the Guest API for custom attributes? Or is this a known bug with the current SDK version?