Chat
Real-time chat with agent presence, offline messaging, and email integration.
How It Works
Reechdesk chat is built on Pusher for real-time WebSocket communication. Here's the flow:
Visitor opens widget → checks agent presence
Agents online → real-time chat begins
No agents → visitor leaves message → offline email sent
Agent replies → email notification to visitor
Agent Presence
Agents are tracked in real-time using Redis-based presence with a 30-second TTL. The widget shows:
- Green dot + agent count — when agents are online
- Agent avatars — who's available to chat
- "Leave a message" — when no agents are online
Agents must send a heartbeat every 15 seconds to stay "online".
Offline Flow
When no agents are online:
- Visitor sends a message
- Widget shows bot acknowledgment after 800ms
- If visitor provided email, an offline response email is sent
- Email includes a "Continue in Chat" link with session resume URL
- When an agent replies, visitor receives an email notification
Email Integration
Two-way email integration:
- Agent reply → Email — when an agent sends a chat message, the visitor receives an email with the message content and a "Continue in Chat" button
- Email reply → Chat — when a visitor replies to the email, their response appears as a chat message in the inbox
Test the flow
Open your app in an incognito window (as a visitor) and in your normal browser (as an agent). Send messages back and forth to see the real-time chat in action.
