The Chat API lets companies open private conversations with individual candidates or broadcast group chats to all applicants for a vacancy. Messages are delivered in real time over a STOMP WebSocket connection; REST endpoints handle chat creation, history retrieval, and state management.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Esteban-Mendez-j/Proyecto-Docker/llms.txt
Use this file to discover all available pages before exploring further.
REST endpoints
All endpoints are under/api/chats and return JSON.
Create a private chat
Opens a one-to-one chat between a company and a specific candidate for a given vacancy. Only users with theEMPRESA role can call this endpoint; the company is derived from the vacancy owner.
ID of the vacancy that this chat is associated with.
ID of the candidate to start the chat with. The candidate must be an active user.
| Code | Meaning |
|---|---|
200 | Chat created. Returns the ChatDTO object. |
400 | Invalid data or the candidate’s account is banned. |
403 | Caller does not have the EMPRESA role. |
Create a group chat for a vacancy
Creates a single group chat for all candidates who have applied to a vacancy.ID of the vacancy whose applicants will be included in the group chat.
| Code | Meaning |
|---|---|
200 | Group chat created. Returns the ChatDTO object. |
403 | Caller does not have the EMPRESA role. |
Get chat info
Returns metadata about a chat together with the authenticated user’s ID and primary role. Requires thejwtToken cookie.
The chat identifier.
Full chat object (see ChatDTO fields below).
The authenticated user’s ID extracted from the JWT.
The user’s primary role (
EMPRESA or CANDIDATO).List messages in a chat
Returns all messages for a chat. The server method accepts a SpringPageable but returns a flat List<MensajeDTO> — results are not wrapped in a Spring Page envelope.
The chat identifier.
MensajeDTO[] array (see MensajeDTO fields below).
List all chats (paginated)
Returns all chats in the system, paginated. Intended for administrative use.Zero-based page number.
Page size.
content array of ChatDTO objects.
List chats by user
Filters chats for a specific user (company or candidate) with optional status and search filters.Either
empresa or candidato.The user’s ID.
Filter by chat status:
activos or inactivos. Omit to return all.Free-text search term applied to chat metadata.
Zero-based page number.
Page size.
Change chat status
Allows the company that created the chat to close or reopen it. Requires thejwtToken cookie; the caller must match the chat’s empresaId.
The chat identifier.
true to reopen the chat; false to close it.| Code | Meaning |
|---|---|
204 | Status updated successfully. No body. |
403 | Caller is not the company that created the chat. |
Add a message (REST)
Persists a message to a chat. For real-time delivery, prefer the WebSocket interface described below.The chat the message belongs to. This value overrides
chatId in the request body.Sender’s user ID.
Recipient’s user ID.
Role of the sender (
EMPRESA or CANDIDATO).Message text.
MensajeDTO with server-assigned time and state.
Data models
ChatDTO fields
Unique chat identifier.
ID of the company that created the chat.
Display name of the company.
ID of the candidate (private chats only).
Display name of the candidate.
ID of the associated vacancy.
Title of the associated vacancy.
Whether the chat is currently open.
Privado for one-to-one chats; Grupo for group chats.Text of the most recent message.
Timestamp of the most recent message.
MensajeDTO fields
ID of the chat this message belongs to.
User ID of the sender.
User ID of the recipient.
Role of the sender.
Role of the recipient.
Message body text.
Server-assigned send timestamp (UTC).
Message delivery state.
WebSocket interface
Real-time messaging uses STOMP over SockJS. The server exposes a single SockJS endpoint at/chats. Once connected, clients send frames to application destinations prefixed with /app and subscribe to topics or user queues.
Broker configuration
| Setting | Value |
|---|---|
| SockJS endpoint | /chats |
| Application destination prefix | /app |
| User destination prefix | /user |
| Simple broker prefixes | /queue, /topic |
Connecting
Send a private message
Publish to/app/chats.sendMessage. The server saves the message and delivers it to both the sender and recipient via their respective /user/queue/messages destinations.
| Direction | Destination |
|---|---|
| Client sends to | /app/chats.sendMessage |
| Client receives from (sender) | /user/{senderEmail}/queue/messages |
| Client receives from (recipient) | /user/{recipientEmail}/queue/messages |
Send a group message
Publish to/app/vacantes/{vacanteId}/chat. All subscribers of /topic/vacantes/{vacanteId}/chat receive the broadcast.
| Direction | Destination |
|---|---|
| Client sends to | /app/vacantes/{vacanteId}/chat |
| Client receives from | /topic/vacantes/{vacanteId}/chat |
Re-subscribing after reconnect
The client singleton inWebsocket.js maintains a subscriptions registry and re-subscribes all registered destinations automatically when STOMP reconnects: