Skip to main content

Endpoint

wss://platform.watermelonn.app/ws?token=YOUR_WIDGET_TOKEN

Incoming message types

TypePurpose
messageSend user chat content.
typingSend typing indicator to other participants.
pingKeepalive check.
historyRequest conversation history.

Outgoing message types

TypePurpose
connectedConfirms successful auth and connection.
messageFinal non-stream response payload.
typingTyping state event.
historyConversation history payload.
pongKeepalive response.
stream_startMarks beginning of streamed assistant response.
stream_chunkOne chunk of generated response text.
stream_endMarks end of streaming.
errorProtocol or processing error.

Example

const ws = new WebSocket('wss://platform.watermelonn.app/ws?token=YOUR_TOKEN');

ws.onopen = () => {
  ws.send(JSON.stringify({
    type: 'message',
    payload: {
      message: 'Cancel my order #5678',
      stream: true
    }
  }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log(data.type, data.payload);
};