Skip to content

Chat

The Chat API provides real-time messaging between hosts and their clients. Messages are delivered via WebSocket for instant delivery and persisted via REST endpoints. All chat endpoints require authentication.


List the authenticated user’s conversations, ordered by most recent activity.

Authentication: Bearer token required.

GET /v1/chat/conversations?page=1&per_page=20
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9...
Query ParameterTypeDescription
pageintegerPage number (default: 1)
per_pageintegerResults per page (default: 20)
{
"success": true,
"data": [
{
"id": "01JN2XA0B1C2D3E4F5G6H7I8J9",
"participant": {
"id": "01JN2X4K8M3F7QPZRVWT6YBHCE",
"display_name": "Jane Smith",
"avatar_url": "https://cdn.vidivo.app/avatars/01JN2X4K.jpg"
},
"last_message": {
"body": "See you tomorrow at 2pm!",
"type": "text",
"sent_at": "2026-03-15T13:45:00Z"
},
"unread_count": 2,
"updated_at": "2026-03-15T13:45:00Z"
}
],
"pagination": {
"page": 1,
"per_page": 20,
"total": 5,
"total_pages": 1
}
}

Get or create a direct conversation with another user. If a conversation already exists between the two users, it is returned.

Authentication: Bearer token required.

POST /v1/chat/conversations
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9...
Content-Type: application/json
{
"user_id": "01JN2X4K8M3F7QPZRVWT6YBHCE"
}
FieldTypeRequiredDescription
user_idstring (UUID)YesThe other participant’s user ID
HTTP/1.1 201 Created
{
"id": "01JN2XA0B1C2D3E4F5G6H7I8J9",
"participant": {
"id": "01JN2X4K8M3F7QPZRVWT6YBHCE",
"display_name": "Jane Smith"
},
"unread_count": 0,
"created_at": "2026-03-15T13:00:00Z"
}

Retrieve messages in a conversation, newest first. The caller must be a participant.

Authentication: Bearer token required.

GET /v1/chat/conversations/01JN2XA0B1C2D3E4F5G6H7I8J9/messages?page=1&per_page=50
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9...
{
"success": true,
"data": [
{
"id": "01JN2XB1C2D3E4F5G6H7I8J9K0",
"conversation_id": "01JN2XA0B1C2D3E4F5G6H7I8J9",
"sender_id": "01JN2X4K8M3F7QPZRVWT6YBHCE",
"body": "See you tomorrow at 2pm!",
"type": "text",
"file_url": null,
"file_name": null,
"file_size": null,
"file_type": null,
"created_at": "2026-03-15T13:45:00Z"
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 12,
"total_pages": 1
}
}
CodeStatusDescription
forbidden403Caller is not a participant in this conversation
not_found404Conversation does not exist

Send a message in a conversation. Supports text messages and file attachments.

Authentication: Bearer token required.

POST /v1/chat/conversations/01JN2XA0B1C2D3E4F5G6H7I8J9/messages
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9...
Content-Type: application/json
{
"body": "Hello! Ready for our session?",
"type": "text"
}
{
"body": "Here is the document I mentioned",
"type": "file",
"file_url": "https://cdn.vidivo.app/files/doc.pdf",
"file_name": "session-notes.pdf",
"file_size": 245760,
"file_type": "application/pdf"
}
FieldTypeRequiredDescription
bodystringYesMessage text content
typestringNotext (default) or file
file_urlstringNoURL to the uploaded file (required for file type)
file_namestringNoOriginal file name
file_sizeintegerNoFile size in bytes
file_typestringNoMIME type of the file
HTTP/1.1 201 Created

Returns the created message object.

CodeStatusDescription
forbidden403User cannot send messages (no active call)
not_found404Conversation does not exist

Mark all messages in a conversation as read for the authenticated user.

Authentication: Bearer token required.

PUT /v1/chat/conversations/01JN2XA0B1C2D3E4F5G6H7I8J9/read
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9...

Returns 204 No Content on success.


Send a message from a host to all of their followers. Creates individual conversations as needed.

Authentication: Bearer token required (role: host or admin).

POST /v1/chat/broadcast
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9...
Content-Type: application/json
{
"body": "I'm available for coaching sessions this afternoon! Book a slot now."
}
FieldTypeRequiredDescription
bodystringYesBroadcast message text
HTTP/1.1 201 Created

wss://api.vidivo.app/v1/chat/ws?token=<access_token>

Pass a valid JWT access token as the token query parameter.

{
"type": "message",
"conversation_id": "01JN2XA0B1C2D3E4F5G6H7I8J9",
"body": "Hello!"
}
{
"type": "typing",
"conversation_id": "01JN2XA0B1C2D3E4F5G6H7I8J9"
}
{
"type": "read",
"conversation_id": "01JN2XA0B1C2D3E4F5G6H7I8J9"
}
{
"type": "new_message",
"message": {
"id": "01JN2XB1C2D3E4F5G6H7I8J9K0",
"conversation_id": "01JN2XA0B1C2D3E4F5G6H7I8J9",
"sender_id": "01JN2X4K8M3F7QPZRVWT6YBHCE",
"body": "Hello!",
"type": "text",
"created_at": "2026-03-15T13:45:00Z"
}
}
{
"type": "typing",
"conversation_id": "01JN2XA0B1C2D3E4F5G6H7I8J9",
"user_id": "01JN2X4K8M3F7QPZRVWT6YBHCE"
}
{
"type": "read_receipt",
"conversation_id": "01JN2XA0B1C2D3E4F5G6H7I8J9",
"user_id": "01JN2X4K8M3F7QPZRVWT6YBHCE"
}
TypeDirectionDescription
messageClient to ServerSend a message
typingBothTyping indicator
readClient to ServerMark conversation as read
new_messageServer to ClientNew message delivered
read_receiptServer to ClientOther user read the conversation

Terminal window
# List conversations
curl "https://api.vidivo.app/v1/chat/conversations" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9..."
# Send a message
curl -X POST "https://api.vidivo.app/v1/chat/conversations/01JN2XA0/messages" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9..." \
-H "Content-Type: application/json" \
-d '{"body":"Hello!","type":"text"}'
# Broadcast to followers
curl -X POST "https://api.vidivo.app/v1/chat/broadcast" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9..." \
-H "Content-Type: application/json" \
-d '{"body":"Available for sessions this afternoon!"}'