Skip to main content
Your client can send the following five event types. Any other type is rejected with an EVENT_TYPE_SYSTEM_MESSAGE error.

EVENT_TYPE_REQUEST_POLY_AGENT_JOIN

Requests the PolyAI agent to join the session. You must send this to start the conversation.
After sending this, you receive (in order):
  1. An echo of your event
  2. EVENT_TYPE_POLY_AGENT_JOINED — the agent has joined
  3. EVENT_TYPE_POLY_AGENT_THINKING — the agent is preparing its greeting
  4. EVENT_TYPE_POLY_AGENT_MESSAGE (or chunks, if streaming) — the greeting message

EVENT_TYPE_USER_MESSAGE

Send a text message from the user.
The server echoes this back with a server-assigned message_id added to the payload.

EVENT_TYPE_USER_TYPING

Notify the server that the user is typing (or has stopped). Use this to show typing indicators on the live agent side.

EVENT_TYPE_USER_END_SESSION

Send when the user deliberately ends the conversation (e.g. clicks a “Leave” button).
This triggers a clean shutdown: the server echoes the event, then sends EVENT_TYPE_SESSION_END with reason REASON_USER_END.

EVENT_TYPE_HEARTBEAT

Keeps the WebSocket alive. Send at regular intervals (typically every 30 seconds). The server echoes it back.
See WebSocket connection → Keeping the connection alive for details.
Last modified on May 18, 2026