Skip to content

Conversations

Conversations is the heart of EmberX. When a guest scans a QR code, a conversation is created and routed to the appropriate Division. Staff can then reply in real time, place orders, and close the chat when done.

How a Conversation Is Created

  1. A guest scans a QR Code (physically placed at a table, room, or reception).
  2. The guest is taken to /chat/{token} — a public chat page.
  3. The system creates a Conversation record linked to:
    • The QR Code token
    • The Division the QR code belongs to
    • The Location (room, table, etc.)
  4. The conversation appears in the staff dashboard under Conversations → Open.

Conversation List View (/conversations)

Filters

TabWhat it shows
OpenActive conversations needing attention (default)
AllEvery conversation regardless of status
ClosedResolved / ended conversations

The list auto-refreshes every 10 seconds via polling, and also updates immediately when a new Socket.IO message arrives.

Each Card Shows

  • Location name + Division badge
  • Unread badge (red) — number of unread messages from the guest
  • Latest message preview — guest messages are shown in their translated form (auto-detected language → staff’s language)
  • Guest language (flag + language name)
  • Time — relative (“2 min ago”, “3 hours ago”) or absolute date

Conversation Detail View (/conversations/{id})

Clicking a conversation opens the full chat interface:

Chat Header

Shows the Location, Division, Guest Language, and current Status badge (Open / Closed).

Message Area

  • Messages from Agents appear on the right (blue).
  • Messages from Customers appear on the left (gray).
  • Auto-scroll to the latest message.
  • When the agent sends a message, an optimistic update immediately shows it — then confirms (or reverts) once the server responds.

Sending Messages

Type in the input bar and press Enter or click Send. Your message is:

  1. Saved to the database.
  2. Broadcast via Socket.IO to all staff watching this conversation.
  3. Auto-translated to the guest’s detected language before delivery.

Real-Time Updates (Socket.IO)

EmberX uses Socket.IO for instant message delivery:

  • Staff join a room named by the conversation ID on page load.
  • Duplicate messages are deduplicated client-side by message.id.
  • On unmount, the socket is disconnected cleanly.

Auto-Translation

EmberX detects the guest’s language from their first message (primaryLanguage field on the Conversation). All subsequent guest messages are:

  • Stored in the original language (content)
  • Translated to English for staff (translatedContent)

Staff replies are translated to the guest’s language before delivery.

Supported languages include English, Vietnamese, Korean, Japanese, Chinese, and more (configured via Settings → Language).

Unread Count

The unreadCount is calculated server-side per conversation. It resets to 0 each time a staff member opens the conversation detail view.

  • Orders — Staff can create an order while in a conversation (/orders inside the chat context)
  • QR Codes — Each conversation originates from a specific QR token
  • Divisions — Conversations are routed to and visible by the assigned Division’s staff