Skip to main content
Each class has a dedicated messaging thread between you and the class teacher. The chat is accessible from the class detail page at /app/alumno/clases/{id_class}.

Opening the chat

On the class detail page, a floating circular button with a chat icon appears in the bottom-right corner (only when neither the chat nor an activity drawer is open). Click it to open the teacher chat as a right-side drawer.
There is one conversation thread per student per class. All messages with the teacher for a given class are in a single thread, ordered chronologically.

Chat drawer

The drawer shows:
  • Header — teacher’s avatar, first name, and last name. An × button closes the drawer.
  • Message list — all messages in the thread, scrollable. Student messages appear on the right; teacher messages appear on the left.
  • Input area — a text input at the bottom and a send button.

Sending a message

1

Open the chat

Click the floating chat button on the class detail page to open the drawer.
2

Type your message

Click the text input and type your message. Messages support standard text and punctuation up to 1,000 characters. Emoji and special characters that do not match the allowed Unicode pattern are rejected by the server.
3

Send

Press Enter or click the send button (paper-plane icon). A loading spinner appears on the button while the request is in flight.
4

Message appears

On success the new message appears at the bottom of the message list and the input clears. The chat scrolls to the bottom automatically.
If the send request fails, your typed message is restored in the input so you can try again.

Message structure

Each message in the thread has the following fields:
FieldTypeDescription
role"student" | "teacher"Who sent the message
contentstringMessage text
seenbooleanWhether the recipient has read the message
seen_atISO timestamp or nullWhen the message was marked as seen
created_atISO timestampWhen the message was sent

Read receipts

When you open the chat drawer, the app automatically marks all unread teacher messages as seen by calling POST /api/student/send-seen-message. The seen flag and seen_at timestamp are set on every teacher message in the thread. For your own messages (role student), the chat footer shows:
  • “Visto with a double-checkmark icon when the teacher has read it.
  • “Enviado: when it has been sent but not yet read.
For teacher messages, the footer shows “Enviado: .

Message history

All messages in the thread load when you open the class detail page (fetched server-side from classes_messages). The complete history is shown each time you open the chat drawer — there is no pagination. The drawer auto-scrolls to the bottom on open.

API reference

Send a message

POST /api/student/send-class-message
Content-Type: multipart/form-data
FieldTypeDescription
messagestringMessage text (max 1,000 characters)
id_classstring (UUID)ID of the class
Response on success
{
  "success": true,
  "message": {
    "role": "student",
    "seen": false,
    "content": "Hola maestra, tengo una duda.",
    "seen_at": null,
    "created_at": "2026-03-25T10:30:00.000Z"
  }
}
If the student is not enrolled in or approved for the class, the endpoint returns 403.

Mark teacher messages as seen

POST /api/student/send-seen-message
Content-Type: multipart/form-data
FieldTypeDescription
id_classstring (UUID)ID of the class
Response
{
  "success": true,
  "updated": 2,
  "messages": [
    {
      "role": "teacher",
      "content": "Hola, claro que sí.",
      "seen": true,
      "seen_at": "2026-03-25T10:31:00.000Z",
      "created_at": "2026-03-25T10:29:00.000Z"
    }
  ]
}
updated is the number of teacher messages that were marked as seen. If all messages were already seen, the endpoint still returns success: true with updated: 0.

Fetch the class chat history

The chat is loaded server-side during the class detail page load, not via a dedicated REST endpoint on the client. The data is available via data.class_data.chat from the SvelteKit page server load function (+page.server.js), which queries the classes_messages table for the current student and class.