WebSocket Endpoint
Endpoint:wss://api.burki.dev/ws/campaigns/{campaign_id}/progress?token={api_key}
This WebSocket endpoint provides real-time streaming of campaign progress updates. Use it to build live monitoring dashboards without polling.
Path Parameters
campaign_id(integer, required): The ID of the campaign to monitor
Authentication
Required: All connections must be authenticated using a valid API key. Pass your API key as a query parameter:Connection Process
- Connect: Establish WebSocket connection with campaign ID and token
- Receive Acknowledgment: Server confirms connection
- Get Initial Data: Receive current progress state
- Stream Updates: Receive real-time progress updates
- Handle Events: Process contact completions, failures, etc.
Server-to-Client Messages
Connection Acknowledgment
Sent immediately after connection is established:Initial Progress
Current campaign state sent after connection:Progress Update
Sent whenever progress changes (contact completed, failed, etc.):Metrics History
Response torequest_history client message:
Pong Response
Response to ping health check:Client-to-Server Messages
Ping (Health Check)
Send periodically to maintain connection:Request Update
Request current progress on demand:Request History
Request historical metrics (last N hours):Progress Fields
Campaign Status Values
Example Usage
JavaScript
Python
React Hook Example
Connection Management
Reconnection Strategy
Implement exponential backoff for reconnection:Keep-Alive
Send ping messages every 30 seconds to maintain the connection:Error Handling
Close Codes
Authentication Errors
If authentication fails, the connection is immediately closed with code 1008:Best Practices
- Always authenticate: Include valid API key in query parameter
- Implement ping/pong: Send pings every 30 seconds to keep connection alive
- Handle reconnection: Implement exponential backoff for reconnection
- Process all message types: Handle connection_ack, initial_progress, progress_update
- Monitor connection state: Track open/close events for UI feedback
- Clean up on unmount: Close WebSocket when component unmounts
Multi-Campaign Monitoring
To monitor multiple campaigns, use the campaigns monitor endpoint: Endpoint:wss://api.burki.dev/ws/campaigns/monitor?token={api_key}
This provides an overview of all campaigns in your organization with the ability to subscribe to specific campaigns.