Trying to ditch the default web messaging widget and spin up a barebones chat interface using the WebSocket Guest API. We’re on genesyscloud-webmessaging-guestsdk@4.1.2 and running Node 18.17 on the backend for token generation. The docs show how to initialize GuestSDK, but the actual message flow keeps tripping me up. Here’s what I’ve got so far:
const guest = new GuestSDK({ orgId: 'abc123', deploymentId: 'def456', language: 'en' });
guest.start();
Once the socket connects, I’m listening for onMessage but the payload structure doesn’t match the REST endpoint examples. When I try to push a guest message back, I’m getting 400 Bad Request with {"errorCode": "invalid_message_format"}. Should I be mapping the content field to type: 'text' or is there a specific GuestMessage constructor I’m missing? Also, the onStatus callback fires connected then immediately drops to idle without ever hitting active.
Anyone got a working snippet for handling the bidirectional flow? The official samples are pretty thin on the actual message serialization logic.