Habify BaseHabify Base
Support & Live ChatHabify Base · Platform Product Team2026-11-267 min read

Building a Customer Support Portal, Ticket Desk, and Realtime Live Chat on Habify Base

Launch a Help Center, private ticket tracking desk, and realtime live chat widget backed by managed WebSockets without maintaining separate socket clusters.

Realtime Live ChatLive NotificationsRole-Scoped TicketsPrivate Attachments
Customer Support Portal and Realtime Live Chat architecture on Habify Base

You can operate a full Help Center, role-isolated ticket inbox, and realtime live chat desk on Habify Base without managing custom Redis Pub/Sub or WebSocket infrastructure. Built-in chat and notification pipelines isolate every conversation cleanly per project.

Help articles and ticket metadata live inside your dedicated PostgreSQL 18 database, while bidirectional messages, typing indicators, reactions, and unread badges stream live over managed Reverb WebSocket channels.

1. Multi-Channel Support Desk & Live Chat Architecture

Whether a visitor is browsing anonymously or signed into a member account, every channel enforces clear access boundaries:

Support FeatureHabify Base CapabilityPrivacy Boundary
Public Help Center (FAQ)Multi-keyword Data API search with exact totalsUnauthenticated readers access published articles only
Ticket trackingsupport_tickets table with PostgreSQL RLSCustomers see own tickets; agents read full queue
Member live chatBrowser-ready chat endpoints (/v1/chat/me/*)Gateway automatically namespaces participants per project
Anonymous visitor chatServer-assisted guest ref + Turnstile gateStops bot floods before opening support threads
Agent & user inbox alertsManaged Notification inbox & Reverb WebSocketsKeeps unread counters synced across browser tabs
Error screenshots & logsPrivate R2 storage + 5-minute signed URLsCustomer attachments stay hidden from public URLs

2. Separating Public FAQs from Private Customer Tickets

Row-Level Security lets your frontend serve public Help Center pages from the exact same API connection while blocking any customer from viewing another person's support ticket.

Staff signing in with role claim 'support_agent' automatically unlock queue visibility inside PostgreSQL:

sql
CREATE TABLE public.faq_articles (
  id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
  slug text NOT NULL UNIQUE,
  title text NOT NULL,
  summary text NOT NULL,
  body_md text NOT NULL,
  is_published boolean NOT NULL DEFAULT false
);

ALTER TABLE public.faq_articles ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.faq_articles FORCE ROW LEVEL SECURITY;
CREATE POLICY faq_public_read ON public.faq_articles
  FOR SELECT USING (is_published = true);

CREATE TABLE public.support_tickets (
  id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
  customer_id uuid NOT NULL,
  subject text NOT NULL,
  status text NOT NULL DEFAULT 'open',
  priority text NOT NULL DEFAULT 'normal',
  created_at timestamptz NOT NULL DEFAULT now()
);

ALTER TABLE public.support_tickets ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.support_tickets FORCE ROW LEVEL SECURITY;

CREATE POLICY tickets_customer_own ON public.support_tickets
  USING (
    customer_id::text = current_setting('app.current_user_id', true)
    OR current_setting('app.current_role', true) = 'support_agent'
  )
  WITH CHECK (
    customer_id::text = current_setting('app.current_user_id', true)
    OR current_setting('app.current_role', true) = 'support_agent'
  );

3. Wiring Realtime Live Chat for Signed-In Members and Guests

Signed-in members call habifyPublic.chat directly from browser components to send messages, emit typing indicators, and subscribe to private Reverb WebSocket channels.

For anonymous visitors opening a website chat bubble, route initial session setup through a Turnstile-protected server Route Handler:

ts
// A. Trình duyệt thành viên (dùng khóa public + phiên đăng nhập user)
const rtConfig = await habifyPublic.chat.getRealtimeConfig();
const { data: conversations } = await habifyPublic.chat.getMyConversations();
await habifyPublic.chat.sendMessage(conversationId, {
  type: "text",
  body: "Mình cần kiểm tra tiến độ đơn hàng #DH1024.",
});
await habifyPublic.chat.authenticateRealtime({ socket_id, channel_name });

// B. Server Route Handler cho khách vãng lai (đã qua kiểm tra Turnstile)
const guestRef = `guest_${verifiedVisitorSessionId}`;
await habifyServer.chat.upsertParticipant(guestRef, { display_name: "Khách mới" });
const conv = await habifyServer.chat.createDirectConversation({
  participant_ref: guestRef,
  target_ref: "agent_queue_main",
});
await habifyServer.chat.sendConversationMessage(String(conv.id), {
  sender_ref: guestRef,
  body: userMessage,
});

4. Private R2 Attachments and Anti-Abuse Guardrails

Customer screenshots and log archives upload straight into private object storage scoped to your project prefix rather than public URLs.

Authorized support agents request a 5-minute signed download URL whenever inspecting a ticket attachment, while Gateway rate limits and storage caps prevent flood abuse.

Frequently Asked Questions

Do I need an external Pusher account or custom Socket.IO server for live chat?

No. Managed Reverb WebSocket channels are built right into Habify Base with browser CORS support.

Can website visitors chat with agents before creating an account?

Yes. Protect an initialization Route Handler with Turnstile and link a signed guest reference directly to your support team queue.

Can support chat messages leak between separate Habify Base projects?

Never. Every participant identifier and WebSocket authorization token is strictly isolated by project scope.

Related Documentation & Guides

Launch This Architecture in Free Sandbox in 3 Minutes

Spin up an isolated PostgreSQL 18 database, grab your hb_pk_* / hb_sk_* keys, and wire @habifybase/sdk.

More Engineering Articles & Use Cases