We’re bypassing the standard Messenger widget for a custom mobile app integration. The goal is to use the Guest API directly to establish a conversation and exchange messages. We’ve got the initial handshake working fine. We generate the token, connect to the WebSocket endpoint, and receive the conversation.created event without issue.
The problem happens the moment we try to send the first message from the guest side. We construct the payload according to the docs, send it over the socket, and get an immediate disconnect. No error event, just a clean closure with code 1000.
Here’s the JSON we’re pushing:
{
"type": "message",
"text": "Hello support",
"conversationId": "conv-123-abc",
"guestId": "guest-456-xyz"
}
The conversationId and guestId match what we got back in the handshake. We’re using the standard wss://api.niceincontact.com/api/v2/conversations/guests endpoint structure, authenticated with the bearer token we generated via the auth flow.
I’ve checked the token scopes. It has conversation:write and conversation:read. Seems sufficient. The server logs show the message arriving but then the connection drops before any response.
Is there a specific header or metadata field missing from the WebSocket frame? Or is the Guest API strictly read-only for custom clients without the widget’s internal state management?
We’ve tried adding a timestamp field and various mediaType values, but it’s the same result. The connection stays open for about 2 seconds after the send, then dies.
Anybody else hit this wall with raw WebSocket implementations? Feels like we’re missing a keep-alive or session validation step that the widget handles automatically.