Corteksa
GuidesMessaging

Events

Messaging — Events

Real-time updates come over Socket.IO, namespace /messaging/events. Connect with the admin JWT in the handshake (auth.token, query.token, or the Authorization header). The tenant is derived from the request host.

On connect you auto-join your visible rooms: tenant:{db}, admin:{id}, and each session:{slug} you're allowed to see. The server emits connected on success, or error (AUTH_MISSING / AUTH_INVALID / ADMIN_NOT_FOUND) then disconnects.

Server → client

The whole event object is the payload (socket.on(type, event)):

EventFires whenKey fields
messageA message is sent or receivedpayload = the message
message-ackDelivery/read status changes{ messageSlug, chatSlug, providerId, ack, acknowledgment }
chat-readA chat is marked readchat + reader
chat.answered"Answered" toggledchat
session.status.updatedSession connects/disconnectssessionSlug, status
message-edited · message-revokedMessage edited/deleted (WAHA)message
callInbound/missed callcall
presence.updateContact online/typingphone, status
label.upsert · label.deleted · label.chats.add · label.chats.deleteLabel changeslabel / chat
dedup.outcomeDuplicate contact resolvedrecord

Fan-out is filtered: broadcastToSession only emits to admins that ChatVisibilityPolicy.selectVisibleAdmins allows, so a client never receives a chat it can't access.

Client → server

Emit these with { sessionSlug, chatSlug } (or { sessionSlug }):

EventMeaning
online / offlinePresence for a session
startTyping / stopTypingTyping indicator
startRecording / stopRecordingVoice recording indicator
seenMark a chat seen

Internal domain events

Messaging also listens to CRM events (server-side only, not over the socket):

EventEffect
notification.admin-assigned.whatsapp.requestedWhatsApp-notify the assigned admin
comment.mentionedWhatsApp-notify the mentioned admin

Next

On this page