When to Use Direct WebSocket
Use the SDK
- Web storefronts (any framework)
- Standard floating or inline widget
- Want built-in UI, reconnection, session management
Use Direct WebSocket
- Backend-to-backend chat (e.g. Telegram bot)
- Mobile apps (React Native, Flutter, native)
- Custom chat UI with full control
- Testing and automation
Quick Start
Handle streaming response
You will receive multiple messages:
{"type": "status", "code": "searching", ...}(progress indicator){"type": "text_delta", "delta": "Here "}(repeated, concatenate){"type": "text_end"}(text block complete){"type": "product_cards", "items": [...]}(product results){"type": "response_complete", ...}(ready for next message)
Python Example
Node.js Example
Session Management
- Save the
conversation_idfromconversation_startedorsession_restored - Pass it in subsequent
messagecalls to continue the same conversation - Sessions expire after 1 hour of inactivity in Redis
- On reconnect with a valid
conversation_id, the server sendssession_restoredwith cart state
Heartbeat
Send{"type": "ping"} every 30 seconds to keep the connection alive. The server also sends pings and expects a {"type": "pong"} response within 60 seconds.