Reference for all WebSocket message types. Use this when building integrations to understand the exact JSON format for every message you send and receive. What you’ll learn: Base message structure, client-to-server messages, server-to-client messages, and event payloads.Documentation Index
Fetch the complete documentation index at: https://docs.blackbox.dasha.ai/llms.txt
Use this file to discover all available pages before exploring further.
Testing requires a valid API key. All examples in this section require authentication with either a web integration token or API key for Dasha BlackBox.
Base message structure
Base message structure
All WebSocket messages share these common fields:
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Message type identifier |
timestamp | string (ISO 8601) | Yes | Message timestamp |
channelId | string | null | No | Optional channel identifier for routing |
Client to server messages
Messages you send to the Dasha BlackBox server.initialize
initialize
Start a new conversation with an agent. Send immediately after WebSocket connection opens.
WebCallStartMessage schema
| Field | Type | Required | Description |
|---|---|---|---|
type | "initialize" | Yes | Message type |
timestamp | string (ISO 8601) | Yes | Message timestamp |
channelId | string | null | No | Channel identifier |
request | object | Yes* | Call configuration (production endpoint) |
request.callType | "chat" | "webCall" | "onPhone" | Yes | Type of conversation |
request.additionalData | object | No | Custom data passed to agent prompts |
request.endpoint | string | null | No | Phone number for onPhone calls |
devRequest | object | Yes* | Call configuration (dev endpoint) |
request (production) or devRequest (development) is required, depending on which endpoint you’re using.
incomingChatMessage
incomingChatMessage
Send a text message to the agent during chat conversations.
IncomingChatMessage schema
| Field | Type | Required | Description |
|---|---|---|---|
type | "incomingChatMessage" | Yes | Message type |
content | string | Yes | Text message content |
timestamp | string (ISO 8601) | Yes | Message timestamp |
channelId | string | null | No | Channel identifier |
sdpAnswer
sdpAnswer
Respond to WebRTC SDP offer for voice calls. Send in response to
sdpInvite message.SdpAnswerMessage schema
| Field | Type | Required | Description |
|---|---|---|---|
type | "sdpAnswer" | Yes | Message type |
timestamp | string (ISO 8601) | Yes | Message timestamp |
channelId | string | null | No | Channel identifier |
data.sdpAnswer | string | Yes | WebRTC SDP answer string |
websocketToolResponse
websocketToolResponse
Return the result of a tool execution requested via WebSocket. Send in response to
websocketToolRequest message.WebsocketToolResponseMessage schema
| Field | Type | Required | Description |
|---|---|---|---|
type | "websocketToolResponse" | Yes | Message type |
timestamp | string (ISO 8601) | Yes | Message timestamp |
channelId | string | null | No | Channel identifier |
content.id | string | Yes | Request ID from websocketToolRequest |
content.result | unknown | Yes | Tool execution result (any JSON value) |
terminate
terminate
End the conversation gracefully. Wait for
conversationResult before closing the WebSocket.TerminateMessage schema
| Field | Type | Required | Description |
|---|---|---|---|
type | "terminate" | Yes | Message type |
timestamp | string (ISO 8601) | Yes | Message timestamp |
channelId | string | null | No | Channel identifier |
Server to client messages
Messages you receive from the Dasha BlackBox server.event
event
System events indicating connection state and lifecycle changes.
EventHistoryMessage schema
| Field | Type | Description |
|---|---|---|
type | "event" | Message type |
name | string | Event name (see below) |
timestamp | string (ISO 8601) | Event timestamp |
channelId | string | null | Channel identifier |
data.recordId | string | null | Call record ID |
data.endpoint | string | null | Phone endpoint (for onPhone calls) |
data.startEstablishConnectionTimeISO | string | null | Connection start time |
data.endEstablishConnectionTimeISO | string | null | Connection established time |
Event names
| Event | Description | When Triggered |
|---|---|---|
connection | Agent session ready | After initialize is processed |
opened | Conversation started | Voice call connected or chat opened |
closed | Conversation ended | After terminate or natural completion |
failedOpen | Failed to open conversation | Agent unavailable, auth failed, etc. |
text
Text messages from agent or user speech transcription.Agent response
Agent response
User message (echo/transcription)
User message (echo/transcription)
TextHistoryMessage schema
| Field | Type | Description |
|---|---|---|
type | "text" | Message type |
timestamp | string (ISO 8601) | Message timestamp |
channelId | string | null | Channel identifier |
content.source | "assistant" | "user" | Message sender |
content.text | string | null | Message text content |
content.name | string | null | Sender name (optional) |
| Field | Type | Description |
|---|---|---|
content.synthStartISOTimes | string | null | TTS synthesis start time |
content.synthEndISOTimes | string | null | TTS synthesis end time |
content.playStartISOTimes | string | null | Audio playback start time |
content.playEndISOTimes | string | null | Audio playback end time |
| Field | Type | Description |
|---|---|---|
content.type | "potential" | "confident" | "final" | Recognition confidence |
content.segmentId | string | Speech segment identifier |
content.startISOTimes | string | Speech start time |
content.endISOTimes | string | null | Speech end time |
Recognition types
| Type | Description | Use Case |
|---|---|---|
potential | Low confidence interim result | Show real-time transcription |
confident | Medium confidence interim result | Update transcription display |
final | Final confirmed transcription | Store in conversation history |
sdpInvite
sdpInvite
WebRTC SDP offer for voice call setup. Respond with
sdpAnswer.SdpInviteMessage schema
| Field | Type | Description |
|---|---|---|
type | "sdpInvite" | Message type |
timestamp | string (ISO 8601) | Message timestamp |
channelId | string | null | Channel identifier |
data.sdpOffer | string | WebRTC SDP offer string |
toolCall
toolCall
Notification that the agent is calling a tool/function.
ToolCallHistoryMessage schema
| Field | Type | Description |
|---|---|---|
type | "toolCall" | Message type |
timestamp | string (ISO 8601) | Message timestamp |
channelId | string | null | Channel identifier |
name | string | Tool name |
args | object | Tool arguments |
callId | string | Unique call identifier |
startISOTimes | string (ISO 8601) | Tool call start time |
toolCallResult
toolCallResult
Result of a tool execution.
ToolCallResultHistoryMessage schema
| Field | Type | Description |
|---|---|---|
type | "toolCallResult" | Message type |
timestamp | string (ISO 8601) | Message timestamp |
channelId | string | null | Channel identifier |
name | string | Tool name |
callId | string | Unique call identifier (matches toolCall) |
startISOTimes | string (ISO 8601) | Tool call start time |
endISOTimes | string (ISO 8601) | Tool call end time |
result | unknown | Tool execution result |
websocketToolRequest
websocketToolRequest
Request to execute a tool via WebSocket (for tools configured with WebSocket execution). Respond with
websocketToolResponse.WebsocketToolRequestHistoryMessage schema
| Field | Type | Description |
|---|---|---|
type | "websocketToolRequest" | Message type |
timestamp | string (ISO 8601) | Message timestamp |
channelId | string | null | Channel identifier |
content.id | string | Request ID (use in response) |
content.toolName | string | Tool name to execute |
content.args | unknown | Tool arguments |
conversationResult
conversationResult
Final conversation summary and metadata. Sent after
terminate or when conversation ends.ConversationResultHistoryMessage schema
| Field | Type | Description |
|---|---|---|
type | "conversationResult" | Message type |
timestamp | string (ISO 8601) | Message timestamp |
channelId | string | null | Channel identifier |
result | object | Conversation result payload |
result object structure depends on your agent configuration.
error
error
Error notification from the server.
ErrorHistoryMessage schema
| Field | Type | Description |
|---|---|---|
type | "error" | Message type |
timestamp | string (ISO 8601) | Message timestamp |
channelId | string | null | Channel identifier |
data.message | string | Error message |
Common error messages
| Error | Cause | Resolution |
|---|---|---|
Invalid token | Authentication failed | Check token validity in dashboard |
Token expired | Token has expired | Generate new token |
Agent not found | Invalid agent reference | Verify agent ID |
Rate limit exceeded | Too many requests | Implement backoff, reduce frequency |
Connection timeout | Session timed out | Reconnect with new session |
Invalid message format | Malformed JSON | Validate message structure |
Message flow diagrams
Chat conversation
Chat conversation
Voice call
Voice call
Tool execution via WebSocket
Tool execution via WebSocket
TypeScript types
TypeScript types
Use these types for type-safe message handling:
Next steps
Chat Implementation
Build a complete chat interface with these messages
Tool Execution
Handle tool calls via WebSocket
Error Handling
Handle errors and edge cases
Voice Implementation
WebRTC voice call message flow