FOCUSCurrently working on ScheduleSomething and LayerdEvents algorithmsLearn More
FOCUSCurrently working on ScheduleSomething and LayerdEvents algorithmsLearn More
FOCUSCurrently working on ScheduleSomething and LayerdEvents algorithmsLearn More
FOCUSCurrently working on ScheduleSomething and LayerdEvents algorithmsLearn More
Git ContextArchitecture
Realtime Inbox Architecture
Docsgit-contextArchitectureRealtime Inbox Architecture
GitHub Live Sync

Realtime Inbox Architecture

Live technical documentation fetched from GitHub repository omghante/metapilot/docs/architecture/realtime-inbox.md

Realtime Chat Inbox Architecture

The Realtime Chat Inbox enables multi-agent customer support over WhatsApp with low-latency WebSocket message broadcasting.

Architecture Blueprint

Rendering diagram...

WebSocket Specification

  • Endpoint:
    /ws/inbox/<tenant_id>/
  • Protocol:
    WSS
    (WebSocket Secure)
  • Channel Group:
    inbox_<tenant_id>

Event Payload Frames

1. Inbound Customer Message Event

json
{
  "type": "new_message",
  "data": {
    "id": "c7a812e9-45bc-48d2-81e1-92fa023bf891",
    "conversation_id": "96598ec0-9ee5-4e10-9948-85894cbc9fcf",
    "sender_phone": "+14155552671",
    "content": "Hello! I need help with my order.",
    "direction": "inbound",
    "timestamp": "2026-07-24T01:20:00Z"
  }
}

2. Message Status Update Event

json
{
  "type": "message_status_update",
  "data": {
    "message_id": "c7a812e9-45bc-48d2-81e1-92fa023bf891",
    "status": "read",
    "updated_at": "2026-07-24T01:20:05Z"
  }
}

Fault Tolerance & Reconnection

  • Heartbeat Ping/Pong: Ping frames sent every 30 seconds to maintain connection health.
  • Automatic Reconnection:
    useWebSocket
    hook in Next.js implements exponential backoff reconnection on disconnection.