Skip to main content

Overview

Socket.IO enables real-time bidirectional communication between your application and the Helpdesk system. This allows instant messaging, voice calls, live notifications, and seamless customer support experiences.

Connection

Authentication

Connect to the Socket.IO server using your API key:
Never expose your API key in client-side code. Fetch it from your backend and pass it to the socket connection.

Connection Response

Upon successful connection, you’ll receive:
If authentication fails, the connection is refused with status_code 400 or 401.

Response Envelope

All event responses follow this envelope:

Event Flow

1

Connect

Authenticate and establish a connection using your API key.
2

Enter Customer Room

Call enter_customer_support with the customer’s session ID immediately after connecting. This subscribes the customer to their personal room so they can receive messages from agents even before a conversation starts.
3

Send & Receive Messages

Use support to send customer messages. Listen on support for SATE (AI) replies and on customer_support for agent replies.
4

Join Conversation Room

After the first message returns a ticket_chat_id, call enter_support to subscribe to that conversation room for all subsequent broadcasts.
5

Mark Read

Call mark_conversation_read whenever the customer views messages.
6

Voice Calls (optional)

Use call_support to start a voice call with SATE and close_call_support to end it.
7

Close & Review

When resolved, call close_support to end the conversation and review_support to collect feedback.

Events Reference

Emitting Events (Client → Server)


Enter Customer Room

Subscribe the customer to their personal room. Call this immediately after connecting so the customer can receive agent messages (customer_support) and auto-close notifications (customer_support_closed) regardless of which conversation is active. Event Name: enter_customer_support
Request Schema
string
required
Unique identifier for the customer — use the same value you send in the support event
Example Request
Response Schema

Enter Conversation Room

Join a specific conversation room to receive real-time updates for that conversation. Event Name: enter_support
Call this after the first support response returns a ticket_chat_id. You only need to call it once per conversation.
Request Schema
string
required
The conversation ID returned from the first support response
Example Request
Response Schema

Leave Conversation Room

Unsubscribe from a conversation room. Event Name: leave_support
Request Schema
string
required
The conversation ID to leave
Example Request
Response Schema

Send Message

The primary event for sending customer messages. SATE (AI) replies come back on the support event; agent replies come on customer_support. Event Name: support
Request Schema
string
required
Unique identifier for the customer
string
required
The message content to send
boolean
required
Whether this message includes an attachment
string
Conversation ID. Set to null for the first message in a new conversation; use the returned ID for all follow-ups.
object | array
Attachment details. Required when attachment is true.
Example Request
Response Schema
After sending, the server emits two separate events: 1. support_echo — Acknowledges that your message was received and queued:
2. support — The AI or agent reply, broadcast to the conversation room:
integer
200 for success
string
Session identifier
string
Status message
object
Response data
data object:
string
The reply message from SATE or an agent
string
Conversation ID — store this from the first response to continue the conversation
string
Who sent the reply: "sate" or "agent"
boolean
Whether the reply includes an attachment
object | null
Attachment details if present
boolean
true when SATE signals that the issue appears resolved and the conversation can be closed
boolean
true when the conversation has been confirmed closed
string
ISO 8601 timestamp
string
ISO 8601 timestamp
Example Response
When close_support is true but closed_support is false, SATE is suggesting the issue looks resolved. Ask the customer to confirm, then call close_support if they agree.
Important Notes
  • New conversations: Set ticket_chat_id to null. Save the ticket_chat_id from the response — you need it for every follow-up message.
  • Conversation limit: Each customer session can have a maximum of 3 open conversations at a time.
  • Attachments: Only available when the responder is "agent". SATE does not send attachments.

Mark Conversation Read

Mark all messages in a conversation as read by the customer. Event Name: mark_conversation_read
Request Schema
string
required
The conversation ID to mark as read
string
required
Who is marking as read. Always use "customer" for customer-side integrations.
Example Request
Response Schema

Start Voice Call

Initiate a voice call with SATE. The server responds with a LiveKit token you use to join the audio room. Event Name: call_support
Request Schema
string
required
Unique identifier for the customer
string
Existing conversation ID. Set to null to start a new conversation via call.
Example Request
Response Schema
The server broadcasts a call_support event to the conversation room with the call details:
string
LiveKit access token — use this with the LiveKit SDK to join the voice room
string
LiveKit room name (matches the ticket_chat_id)
string
Conversation ID
string
Unique ID for this call
string
ISO 8601 timestamp of when the call started
Example Response
Important Notes
  • Availability: Voice calls are only available while SATE is the active responder and no other call is in progress.
  • Voice room: Pass the token to the LiveKit client SDK to connect to the audio room.
  • Room name: The LiveKit room name is the same as ticket_chat_id.

End Voice Call

End an active voice call. Event Name: close_call_support
Request Schema
string
required
The conversation ID for the active call
Example Request
Response Schema
The server broadcasts a close_call_support event to the conversation room:
string
LiveKit room name
string
Conversation ID
string | null
Call ID — null if no active call was found
string
ISO 8601 call start timestamp
string
ISO 8601 call end timestamp
Example Response

Close Conversation

End a conversation when the issue is resolved. Event Name: close_support
Call this only after SATE sets close_support: true in a message and the customer confirms they want to end the conversation.
Request Schema
string
required
The conversation ID to close
Example Request
Response Schema

Review Support

Collect customer feedback after a conversation ends. Event Name: review_support
Request Schema
string
required
The conversation ID to review
string
required
Customer rating: "1", "2", "3", "4", or "5"
string
Optional customer feedback text
Example Request
Response Schema

Server Broadcasts (Server → Client)

These are events the server pushes to your client. Set up listeners for them to handle real-time updates.

Agent Message Received

Fired when a human agent sends a reply. Agent messages arrive on this event — not on support — so you must listen on both. Listen On: customer_support
This event is delivered to the customer’s personal room (set up via enter_customer_support), so it works even before the customer has joined a specific conversation room.
Response Schema
string
Agent’s reply message
string
Conversation ID
string
Always "agent" for this event
boolean
Whether the message includes an attachment
object | null
Attachment details if present
boolean
Whether the agent is suggesting closure
boolean
Whether the conversation is closed
string
ISO 8601 timestamp
string
ISO 8601 timestamp
Example

Conversation Auto-Closed

Fired when SATE closes a conversation automatically — without waiting for the customer to confirm. Update your UI to reflect the closed state. Listen On: customer_support_closed
Response Schema
string
The parent ticket ID
string
The conversation ID that was closed
string
Updated ticket status
Example

Handler Changed

Fired when a human agent takes over a conversation from SATE. Use this to show a notification like “You are now chatting with a human agent.” Listen On: support_handler_changed
Response Schema
string
The conversation ID
string
The new handler type: "agent"
object
Details of the agent who took over
agent object:
string
Agent’s unique ID
string
Agent’s display name
Example

SATE Left Call

Fired when SATE disconnects from an active voice call. Handle this to update your call UI and give the customer the option to end or wait. Listen On: sate_left_call
Response Schema
string
The conversation ID
string
The call ID
Example

Implementation Example

A complete example showing the full conversation and call flow:

Next Steps