Skip to main content
GET
/
api
/
v1
/
ws
/
webCall
WebSocket endpoint for web calls
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://blackbox.dasha.ai/api/v1/ws/webCall', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Connection Types

Chat (chat):
  • Text-based conversations without voice
  • No WebRTC required
  • Lower bandwidth usage
  • Use cases: customer support chat, FAQ bots
Web Call (webCall):
  • Browser-based voice calls using WebRTC
  • Real-time audio streaming
  • Requires HTTPS and microphone access
  • Use cases: voice customer support, interactive demos
Phone Call (onPhone):
  • Traditional phone calls via SIP
  • External phone number required
  • Works with landlines/mobile devices
  • Use cases: outbound campaigns, call centers

Message Format

All messages use JSON structure:
{
  "type": "message_type",
  "timestamp": "2024-01-01T00:00:00.000Z",
  "data": {},
  "content": {}
}

Client → Server Messages

  • initialize: Start new conversation with call type
  • incomingChatMessage: Send text message
  • sdpAnswer: Respond to WebRTC SDP offer
  • websocketToolResponse: Return tool execution result
  • terminate: End conversation

Server → Client Messages

  • event: System events (connection, opened, closed)
  • text: Text messages from agent or user
  • sdpInvite: WebRTC SDP offer for voice calls
  • toolCall: Agent requesting tool execution
  • conversationResult: Final conversation summary
  • error: Error messages

Connection Flow

  1. Establish connection to WebSocket endpoint
  2. Send initialize message with call type and configuration
  3. Receive connection event when agent is ready
  4. Exchange messages bidirectionally
  5. Send terminate to end session gracefully

Query Parameters

token
string
required

Web integration token for authentication

authorization
string

Bearer token for user authentication (alternative to Authorization header)

Response

Switching Protocols - WebSocket connection established