Why does the WebSocket connection to the Genesys Cloud Guest API terminates right after I send the first message event? I am building a custom chat UI in Python using the websockets library to bypass the heavy overhead of the default widget. The handshake works fine, and I get the initial session event with the session_id. However, as soon as I push a message event, the server closes the connection with code 1000. Here is the JSON payload I am constructing for the message event:
{
"type": "message",
"id": "msg-12345",
"from": {
"type": "user",
"id": "guest-abc-123"
},
"text": "Testing custom UI integration",
"session_id": "sess-xyz-789"
}
My code connects to wss://{my-org}.mypurecloud.com/api/v2/analytics/events/guest (or the correct guest endpoint if that’s wrong, I’m guessing based on docs). I suspect the session_id isn’t being persisted correctly in the client context or the payload structure is slightly off for the raw WebSocket protocol versus the REST API. Any insights on the exact schema required for the initial message event in the WebSocket stream?