Overview
Messages are the core communication unit in Vocantly. They support real-time delivery, persistence, receipts, and various message types.Message Flow
Sending Messages
Via WebSocket (Real-time)
Messages are sent through WebSocket connections for real-time delivery. Using the SDK:Messages are sent via WebSocket only. There is no REST API endpoint for sending messages. Use the SDK or connect directly to WebSocket.
Receiving Messages
Real-time (WebSocket)
Messages are delivered in real-time to all connected clients in the conversation:Historical Messages (REST API)
Retrieve message history using the REST API:limit- Number of messages (default: 20, max: 100)cursor- ISO timestamp for pagination
Message Types
Text Messages
Standard text messages:System Messages
System-generated messages (bot replies, notifications):Message States
Messages go through different states:- Sent - Message sent by client (optimistic)
- Delivered - Message delivered to recipients
- Read - Message read by recipients
Tracking Message States
Message Deduplication
The SDK automatically handles message deduplication:- Optimistic messages - Created immediately when sending
- Server confirmation - Replaces optimistic message when server confirms
- Duplicate prevention - Same message_id won’t be processed twice
Pagination
Messages are paginated using cursor-based pagination:Messages are ordered by
created_at DESC (newest first). The cursor is the created_at timestamp of the last message.Message Metadata
Messages can include optional metadata:Error Handling
Connection Errors
Message Send Errors
Best Practices
Optimistic Updates
Show messages immediately, then reconcile with server confirmation
Pagination
Use cursor-based pagination for message history
Error Handling
Always handle connection and send errors gracefully
Receipt Tracking
Track delivery and read receipts for better UX
Next Steps
Receipts
Learn about delivery and read receipts
Realtime
Real-time messaging features
API Reference
View message API endpoints
SDK
SDK messaging guide