Live Dashboard - Inbox Module
The Inbox module is the central communication hub for UnifiedBeez, enabling organizations to manage all customer conversations across multiple channels (WhatsApp, Email, Instagram, Facebook Messenger, Telegram, SMS) in a single unified interface. It supports both individual agent workflows and team collaboration with assignment, labeling, and automation capabilities.
| Channel | Features | Message Types | Special Constraints |
|---|---|---|---|
| WhatsApp Business API | Templates, Free-form, Media, Location | Text, Image, Video, Audio, Document, Location | 24-hour window for free-form messages |
| Email (SMTP/IMAP) | HTML emails, Attachments, Threading | HTML, Plain text, Attachments | None |
| Instagram Direct | Text, Media, Story replies | Text, Image, Video | 7-day response window |
| Facebook Messenger | Text, Quick replies, Buttons, Carousels | Text, Image, Video, Audio, Templates | 7-day response window |
| Telegram | Text, Inline keyboards, Media | Text, Image, Video, Audio, Document | None |
| SMS (Twilio) | Plain text messages | Text only (160 chars per segment) | Character limit, No media |
Color-coded labels for categorization
Custom fields for contact data
Event-based workflow execution
The Inbox module is built using a microservices-oriented architecture with NestJS. Core services handle conversations, messages, channel integrations, and real-time communication. Services are loosely coupled and communicate via events and dependency injection.
Responsibility: Main orchestration service for inbox operations
Key Methods:
getInboxView(userId, view, filters) - Retrieve conversations based on view typesendMessage(conversationId, userId, content, options) - Send outgoing messagemarkConversationAsRead(conversationId, userId) - Update read statussearchConversations(query, filters) - Full-text search across conversationsResponsibility: Manage conversation lifecycle and metadata
Key Methods:
createConversation(contactId, channel, metadata) - Initialize new conversationassignConversation(conversationId, assignTo) - Assign to user or teamupdateStatus(conversationId, status) - Change lifecycle statusaddLabel(conversationId, labelId) - Apply label for categorizationgetConversationDetails(conversationId) - Full conversation with messagesResponsibility: Handle message creation, retrieval, and search
Key Methods:
createMessage(conversationId, content, messageType) - Store new messagegetMessageHistory(conversationId, pagination) - Retrieve conversation messagessearchMessages(query, filters) - Search message contentupdateMessageStatus(messageId, status) - Track delivery/read receiptsResponsibility: Normalize and route messages across all channels
Channel Adapters:
Common Methods (per adapter):
sendMessage(to, content, options)normalizeIncoming(payload) - Convert to unified formatvalidateWebhook(signature, payload)Responsibility: Real-time bidirectional communication
Key Features:
| Service | Depends On | Emits Events |
|---|---|---|
| InboxService | ConversationService, MessageService, ChannelIntegrationService | inbox.message_sent, inbox.conversation_opened |
| ConversationService | ContactService, MessageService | conversation.created, conversation.assigned, conversation.status_changed |
| MessageService | Database, FileStorageService (for media) | message.created, message.status_updated |
| ChannelIntegrationService | HTTP Client, External APIs | channel.message_received, channel.webhook_verified |
| WebSocketGateway | AuthService, Redis (for presence) | WebSocket events (message.received, user.typing, etc.) |
The Inbox module exposes 35+ RESTful API endpoints for managing conversations, messages, channel integrations, and settings. All endpoints require JWT authentication and follow RESTful conventions with proper HTTP status codes.
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /api/inbox/conversations |
Get all conversations with filters | Query: view, status, assignee, labels, channel |
| GET | /api/inbox/conversations/:id |
Get single conversation details | - |
| POST | /api/inbox/conversations |
Create new conversation | { contactId, channel, initialMessage } |
| PATCH | /api/inbox/conversations/:id/assign |
Assign conversation to user/team | { assigneeId, assigneeType: 'user'|'team' } |
| PATCH | /api/inbox/conversations/:id/status |
Update conversation status | { status: 'new'|'active'|'resolved'|'closed' } |
| POST | /api/inbox/conversations/:id/labels |
Add labels to conversation | { labelIds: [1, 2, 3] } |
| DELETE | /api/inbox/conversations/:id/labels/:labelId |
Remove label from conversation | - |
| POST | /api/inbox/conversations/:id/notes |
Add private note to conversation | { content, mentions: [userId1, userId2] } |
| PATCH | /api/inbox/conversations/:id/read |
Mark conversation as read | - |
| GET | /api/inbox/conversations/search |
Search conversations | Query: q, filters |
| POST | /api/inbox/conversations/bulk-assign |
Bulk assign conversations | { conversationIds: [], assigneeId } |
| POST | /api/inbox/conversations/bulk-label |
Bulk add labels | { conversationIds: [], labelIds: [] } |
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /api/inbox/messages/:conversationId |
Get message history | Query: page, limit, before, after |
| POST | /api/inbox/messages/send |
Send message | { conversationId, content, type, attachments } |
| POST | /api/inbox/messages/send-template |
Send WhatsApp template | { conversationId, templateId, params } |
| POST | /api/inbox/messages/upload |
Upload media attachment | FormData: file, conversationId |
| GET | /api/inbox/messages/search |
Search message content | Query: q, conversationId, channel |
| PATCH | /api/inbox/messages/:id/status |
Update message status | { status: 'sent'|'delivered'|'read'|'failed' } |
| POST | /api/inbox/messages/:id/react |
React to message | { emoji: '👍' } |
| DELETE | /api/inbox/messages/:id |
Delete message | - |
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /api/inbox/channels |
Get all connected channels | - |
| POST | /api/inbox/channels/whatsapp |
Connect WhatsApp Business API | { phoneNumberId, accessToken, wabaId } |
| POST | /api/inbox/channels/email |
Connect email (SMTP/IMAP) | { email, smtpHost, imapHost, credentials } |
| POST | /api/inbox/channels/social |
Connect social media (Instagram/FB) | { platform, pageId, accessToken } |
| DELETE | /api/inbox/channels/:id |
Disconnect channel | - |
| POST | /api/inbox/webhooks/:channel |
Handle incoming webhooks | Channel-specific payload |
| GET | /api/inbox/channels/:id/health |
Check channel connection health | - |
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /api/inbox/templates |
Get all templates (canned responses) | Query: type (general, whatsapp, preset) |
| POST | /api/inbox/templates |
Create new template | { name, content, type, category } |
| PUT | /api/inbox/templates/:id |
Update template | { name, content } |
| DELETE | /api/inbox/templates/:id |
Delete template | - |
| GET | /api/inbox/attributes |
Get contact attributes schema | - |
| POST | /api/inbox/attributes |
Create custom attribute | { name, type, validationRules } |
| GET | /api/inbox/labels |
Get all labels | - |
| POST | /api/inbox/labels |
Create new label | { name, color, description } |
The Inbox module uses 8 primary tables in PostgreSQL to store conversations, messages, channel connections, templates, and settings. All tables use JSONB columns for flexible metadata storage and support full-text search via PostgreSQL's built-in capabilities.
Purpose: Store conversation metadata and lifecycle
Purpose: Store individual messages within conversations
Purpose: Store connected channel credentials and settings
Purpose: Store canned responses and WhatsApp templates
Purpose: Many-to-many relationship for conversation categorization
Purpose: Store labels for conversation categorization
Purpose: Define custom fields for contacts
Purpose: Store private team notes on conversations
UnifiedBeez integrates with WhatsApp Business API (Cloud API) via Meta's official API. This integration enables sending template messages, receiving inbound messages, managing media, and tracking message delivery status. The integration handles the 24-hour messaging window constraint and template approval workflows.
(WhatsApp)
(Cloud API)
(NestJS Controller)
(UnifiedBeez UI)
(API Call)
(24-48 hours)
| Status | Description | Webhook Event | Action in UnifiedBeez |
|---|---|---|---|
| sent | Message sent to Meta API | - | Create message record, status = 'sent' |
| delivered | Delivered to customer's device | status: 'delivered' | Update message status, set delivered_at timestamp |
| read | Customer opened message | status: 'read' | Update status, set read_at, show double checkmark |
| failed | Delivery failed | status: 'failed', error | Update status, store error reason, notify agent |
The Template Management system enables organizations to create, manage, and deploy reusable message templates across all communication channels. This includes WhatsApp Business API templates (requiring Meta approval), general canned responses for quick replies, and preset templates for common use cases. Templates support variable placeholders, multi-language content, and usage analytics to optimize agent productivity and message consistency.
Pre-approved templates by Meta for messages outside 24-hour window
Quick replies for agents across all channels
Industry-specific templates provided by UnifiedBeez
Responsibility: Manage template lifecycle and validation
Key Methods:
createTemplate(organizationId, templateData) - Create new templateupdateTemplate(templateId, updates) - Modify existing templatedeleteTemplate(templateId) - Remove templategetTemplates(organizationId, filters) - List templates with filteringsearchTemplates(query) - Full-text search across template contentvalidateVariables(content, variables) - Ensure placeholders are validtrackUsage(templateId, messageId) - Log template usage for analyticsResponsibility: Handle WhatsApp-specific template operations with Meta API
Key Methods:
submitToMeta(templateData) - Submit template for approvalcheckApprovalStatus(templateId) - Poll Meta API for status updatessyncTemplatesFromMeta(wabaId) - Import approved templates from MetadeleteMetaTemplate(templateId) - Remove from Meta and local DBhandleWebhook(payload) - Process template status webhooks from Meta| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /api/templates |
Get all templates | Query: type (general, whatsapp, preset), category |
| GET | /api/templates/:id |
Get single template details | - |
| POST | /api/templates |
Create new template | { name, content, type, category, variables } |
| PUT | /api/templates/:id |
Update template | { name, content, variables } |
| DELETE | /api/templates/:id |
Delete template | - |
| POST | /api/templates/whatsapp/submit |
Submit WhatsApp template to Meta | { name, category, language, components } |
| GET | /api/templates/whatsapp/:id/status |
Check Meta approval status | - |
| POST | /api/templates/whatsapp/sync |
Sync approved templates from Meta | { wabaId } |
| GET | /api/templates/preset |
Get preset template library | Query: industry, category |
| POST | /api/templates/preset/:id/import |
Import preset template to org | - |
| GET | /api/templates/search |
Search templates by content | Query: q, type |
| GET | /api/templates/:id/analytics |
Get template usage analytics | Query: startDate, endDate |
UnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Inbox Settings - General Templates.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Inbox Settings - Whatsapp Templates.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Inbox Settings - Preset Templates.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Inbox Settings - Create new Whatsapp Templates.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Inbox Settings - Create new Whatsapp Templates-1.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Inbox Settings - Create new Whatsapp Templates-2.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Inbox Settings - Create new Whatsapp Templates-3.pngUnifiedBeez_UI_UX/Live Dashboard UI - Internal Operations and Admin/Internal Operations & Admin - Templates Libraries.pngThe Contact Attributes system enables organizations to define custom fields for storing additional information about contacts and conversations. This flexible schema system supports 10+ field types (text, number, date, boolean, select, multiselect, email, phone, URL, file) with validation rules, default values, and conditional visibility. Attributes power segmentation, personalization, and automation workflows across the entire UnifiedBeez platform.
Single-line text input (max 255 chars)
Multi-line text (unlimited length)
Integer or decimal with min/max validation
Date picker (YYYY-MM-DD format)
Date + time picker with timezone
Checkbox (true/false)
Dropdown (single choice)
Multiple checkboxes
Email validation
Phone number with country code
URL validation (http/https)
File upload (S3 storage)
Responsibility: Manage attribute schema and values
Key Methods:
createAttribute(organizationId, attributeData) - Define new custom attributeupdateAttribute(attributeId, updates) - Modify attribute schemadeleteAttribute(attributeId) - Remove attribute (cascade delete values)getAttributes(organizationId, scope) - List attributes by scope (contact/conversation)validateValue(attributeId, value) - Validate against validation rulessetAttributeValue(entityId, attributeId, value) - Store attribute valuegetAttributeValues(entityId) - Retrieve all attribute values for entityResponsibility: Integrate attributes with contact operations
Key Methods:
enrichContactWithAttributes(contactId) - Fetch contact with all custom attributesupdateContactAttributes(contactId, attributes) - Bulk update attribute valuessegmentContacts(attributeFilters) - Filter contacts by attribute valuesexportContactsWithAttributes(filters) - CSV export with custom fields| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /api/attributes |
Get all attribute schemas | Query: scope (contact, conversation) |
| GET | /api/attributes/:id |
Get single attribute schema | - |
| POST | /api/attributes |
Create new attribute | { key, label, dataType, validationRules, scope } |
| PUT | /api/attributes/:id |
Update attribute schema | { label, validationRules, defaultValue } |
| DELETE | /api/attributes/:id |
Delete attribute | - |
| GET | /api/contacts/:id/attributes |
Get contact attribute values | - |
| PUT | /api/contacts/:id/attributes |
Update contact attributes | { attributes: { customer_tier: 'gold', ... } } |
| GET | /api/conversations/:id/attributes |
Get conversation attribute values | - |
| PUT | /api/conversations/:id/attributes |
Update conversation attributes | { attributes: { priority: 'high', ... } } |
| POST | /api/attributes/validate |
Validate attribute value | { attributeId, value } |
UnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Attributes.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/General Inbox - Attributes Contacts.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Attributes modal.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Inbox Settings - Contacts attributes.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Inbox Settings - Create new attributes.pngUnifiedBeez_UI_UX/Live Dashboard UI - Internal Operations and Admin/Internal Operations & Admin - Inbox Attributes Preview ( Contacts ).pngThe Team Inbox enables collaborative conversation management with shared visibility, intelligent assignment, collision detection, private notes, and workload balancing. Multiple agents can work together on conversations while avoiding duplicate responses, tracking accountability, and maintaining context through @mentions and internal notes. The system supports both manual and automated assignment strategies (round-robin, load-balanced, skill-based) with real-time updates via WebSocket.
All team members see unassigned conversations and can claim them. Filter by team, assignee, or status.
Auto-assign via round-robin, load-balanced (least busy), or skill-based routing. Manual assignment supported.
Real-time typing indicators show when another agent is composing. Prevents duplicate responses.
Internal notes visible only to team. @mention colleagues to notify them of important context.
Tag team members with @username to notify them. Mentions tracked in notifications panel.
Set max conversations per agent. Auto-assignment pauses when agent reaches capacity.
Agents mark themselves as away/offline. System auto-reassigns their conversations to available teammates.
Responsibility: Orchestrate team inbox operations
Key Methods:
getTeamInboxView(teamId, filters) - Retrieve team conversations with filtersclaimConversation(conversationId, userId) - Agent claims unassigned conversationtransferConversation(conversationId, fromUserId, toUserId) - Transfer between agentsgetTeamWorkload(teamId) - View active conversations per agentbroadcastTypingIndicator(conversationId, userId, isTyping) - Collision preventionResponsibility: Intelligent conversation routing
Assignment Strategies:
roundRobinAssignment(teamId) - Distribute evenly in rotationloadBalancedAssignment(teamId) - Assign to agent with fewest active conversationsskillBasedAssignment(conversationId, requiredSkills) - Match agent expertisepriorityAssignment(conversationId, priority) - Route high-priority to senior agentscheckAgentAvailability(userId) - Verify agent is online and under capacityResponsibility: Track agent online/offline status
Key Methods:
setUserStatus(userId, status) - Update status (online, away, busy, offline)getUserStatus(userId) - Check if agent is availablehandleStatusChange(userId, newStatus) - Trigger reassignment if awaybroadcastPresenceUpdate(userId) - Notify team via WebSocket| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /api/inbox/team/:teamId |
Get team inbox conversations | Query: status, assignee, priority |
| POST | /api/inbox/assign |
Manually assign conversation | { conversationId, assignToUserId } |
| POST | /api/inbox/claim |
Agent claims unassigned conversation | { conversationId } |
| POST | /api/inbox/transfer |
Transfer conversation to another agent | { conversationId, toUserId, reason } |
| POST | /api/inbox/auto-assign |
Auto-assign via strategy | { conversationId, strategy: 'round_robin'|'load_balanced' } |
| GET | /api/inbox/team/:teamId/workload |
View team workload distribution | - |
| POST | /api/inbox/notes |
Add private note to conversation | { conversationId, content, mentions: [userId1] } |
| GET | /api/inbox/conversations/:id/notes |
Get all notes for conversation | - |
| DELETE | /api/inbox/notes/:id |
Delete private note | - |
| POST | /api/inbox/typing |
Send typing indicator | { conversationId, isTyping: true|false } |
| GET | /api/inbox/conversations/:id/viewers |
See who's currently viewing conversation | - |
| PUT | /api/users/:id/status |
Update agent status | { status: 'online'|'away'|'busy'|'offline' } |
| GET | /api/inbox/team/:teamId/presence |
Get team presence status | - |
| POST | /api/inbox/reassign-bulk |
Bulk reassign conversations | { fromUserId, toUserId, conversationIds: [] } |
| GET | /api/inbox/mentions |
Get user's @mentions notifications | Query: unreadOnly |
UnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Team Inbox.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Team Inbox - Collapsed.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Team Inbox - Info Open.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Team Inbox - Info Open - Dropdown.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Team inbox - Team attrributes.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Team Inbox - See all channels.pngUnifiedBeez_UI_UX/Live Dashboard UI - Dashboard/Settings - Team.pngUnifiedBeez_UI_UX/Live Dashboard UI - Dashboard/Live Dashboard - Team Members.pngUnifiedBeez_UI_UX/Live Dashboard UI - Dashboard/Live Dashboard - Insights - Team Members.pngUnifiedBeez_UI_UX/Beehive Dashboard UI/Add team member.pngUnifiedBeez_UI_UX/Live Dashboard UI - Internal Operations and Admin/Internal Operations & Admin - Core ( Team Directory ).pngUnifiedBeez_UI_UX/Live Dashboard UI - Internal Operations and Admin/Internal Operations & Admin - Inbox Attributes Preview (Teams).pngThe Labels system provides flexible, color-coded categorization for conversations, enabling organizations to organize and filter conversations by topic, priority, sentiment, or any custom dimension. Labels support multi-label assignments (one conversation can have multiple labels), hierarchical structures (parent-child relationships), auto-labeling via automation rules, and bulk operations. Labels are used extensively in inbox filtering, reporting, and automation workflows.
Assign hex colors to labels for visual identification. Support for 16+ standard colors.
Apply multiple labels per conversation (e.g., "Sales", "Urgent", "VIP Customer").
Nested labels (e.g., "Support" > "Technical Issue" > "Billing Error").
Automation rules auto-apply labels based on keywords, sentiment, or channel.
Filter inbox by single or multiple labels. Search conversations by label name.
Responsibility: Manage label definitions and assignments
Key Methods:
createLabel(organizationId, labelData) - Create new labelupdateLabel(labelId, updates) - Modify label (name, color, description)deleteLabel(labelId) - Remove label (cascade remove from conversations)getLabels(organizationId, filters) - List all labels with hierarchyapplyLabel(conversationId, labelId, userId) - Add label to conversationremoveLabel(conversationId, labelId) - Remove label from conversationbulkApplyLabels(conversationIds, labelIds) - Bulk label assignmentResponsibility: Handle hierarchical label structures
Key Methods:
createHierarchy(parentLabelId, childLabelData) - Create nested labelgetLabelTree(organizationId) - Retrieve full label hierarchymoveLabelToParent(labelId, newParentId) - Reorganize hierarchygetConversationsByLabelPath(labelPath) - Query by full path (e.g., "Support/Billing")| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /api/labels |
Get all labels | Query: includeHierarchy |
| GET | /api/labels/:id |
Get single label details | - |
| POST | /api/labels |
Create new label | { name, color, description, parentLabelId } |
| PUT | /api/labels/:id |
Update label | { name, color, description } |
| DELETE | /api/labels/:id |
Delete label | - |
| POST | /api/conversations/:id/labels |
Apply labels to conversation | { labelIds: [1, 2, 3] } |
| DELETE | /api/conversations/:id/labels/:labelId |
Remove label from conversation | - |
| POST | /api/labels/bulk-apply |
Bulk apply labels | { conversationIds: [], labelIds: [] } |
| GET | /api/labels/:id/conversations |
Get all conversations with label | Query: page, limit |
| GET | /api/labels/analytics |
Label usage analytics | Query: startDate, endDate |
UnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Labels.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/General Inbox - Labels.pngUnifiedBeez_UI_UX/Beehive Dashboard UI/Labels.pngUnifiedBeez_UI_UX/Beehive Dashboard UI/General Inbox - Labels.pngUnifiedBeez_UI_UX/Automations Library + Builders - Support and Escalation/Input with label.pngThe Inbox Settings module provides comprehensive configuration options for customizing inbox behavior, appearance, notifications, and preferences at both organizational and individual user levels. Settings include working hours, auto-assignment rules, notification preferences, signature management, away messages, and channel-specific configurations. Settings are validated and persisted in PostgreSQL with real-time updates via WebSocket.
Responsibility: Manage inbox settings and preferences
Key Methods:
getSettings(organizationId, scope) - Retrieve settings by scope (org, team, user)updateSettings(scope, settingsData) - Update settings (with validation)getDefaultSettings() - Return default settings for new organizationsvalidateSettings(settingsData) - Validate settings before savingexportSettings(organizationId) - Export settings as JSONimportSettings(organizationId, settingsJson) - Bulk import settingsResponsibility: Handle multi-level settings hierarchy
Key Methods:
resolveSettings(userId) - Merge org, team, and user settings (inheritance)getEffectiveSettings(userId, key) - Get final setting value (user override > team > org)resetToDefaults(scope, settingKey) - Reset specific setting to default| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /api/inbox/settings |
Get current user's inbox settings | - |
| PUT | /api/inbox/settings |
Update user inbox settings | { notifications, workingHours, preferences } |
| GET | /api/inbox/settings/organization |
Get organization-level settings | - |
| PUT | /api/inbox/settings/organization |
Update organization settings (admin only) | { autoAssignment, retentionPolicy, ... } |
| GET | /api/inbox/settings/team/:teamId |
Get team-level settings | - |
| PUT | /api/inbox/settings/team/:teamId |
Update team settings | { maxConversationsPerAgent, workingHours } |
| POST | /api/inbox/settings/reset |
Reset settings to defaults | { scope: 'user'|'team'|'organization', keys: [] } |
| GET | /api/inbox/settings/export |
Export settings as JSON | Query: scope |
UnifiedBeez_UI_UX/Live Dashboard UI - Dashboard/Settings.pngUnifiedBeez_UI_UX/Live Dashboard UI - Dashboard/Settings - Notifications.pngUnifiedBeez_UI_UX/Live Dashboard UI - Dashboard/Settings - Preference.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Inbox Settings - General Templates.pngThe Real-Time Communication layer enables instant bidirectional message delivery between the UnifiedBeez backend and connected clients (agents, customers) using Socket.IO and WebSocket protocol. This system powers live message delivery, typing indicators, presence status, collision detection, and real-time UI updates across the entire platform. The architecture uses Redis pub/sub for multi-instance synchronization, JWT authentication for secure connections, and AWS ECS Fargate with sticky sessions for scalable WebSocket hosting.
Socket.IO Client Library (v4.8.1)
Sticky sessions enabled (AWSALB cookie)
Socket.IO Server
Socket.IO Server
Socket.IO Server
Synchronize events across all Socket.IO instances
Responsibility: Handle WebSocket connections and events
Implementation:
Responsibility: Manage socket connections and room broadcasting
Key Methods:
emitToUser(userId, event, data) - Send event to specific user (all devices)emitToOrganization(orgId, event, data) - Broadcast to all org membersemitToConversation(conversationId, event, data) - Send to conversation participantsemitToRoom(roomId, event, data) - Generic room broadcastsetUserOnline(userId) - Mark user as online in RedissetUserOffline(userId) - Mark user as offline in RedisgetUsersInRoom(roomId) - Get list of connected users in room| Event Name | Direction | Payload | Description |
|---|---|---|---|
conversation:new |
Server → Client | { conversation, contact } | New conversation created |
message:received |
Server → Client | { message, conversationId } | New message received |
message:sent |
Server → Client | { message, conversationId } | Message sent successfully |
message:status |
Server → Client | { messageId, status } | Message status update (delivered, read) |
typing:start |
Client → Server | { conversationId } | User started typing |
typing:stop |
Client → Server | { conversationId } | User stopped typing |
typing:indicator |
Server → Client | { conversationId, userId, isTyping } | Broadcast typing status to other users |
presence:update |
Server → Client | { userId, status } | User presence changed (online, away, offline) |
conversation:assigned |
Server → Client | { conversationId, assignedTo } | Conversation assigned to user/team |
conversation:status |
Server → Client | { conversationId, status } | Conversation status changed |
label:applied |
Server → Client | { conversationId, label } | Label added to conversation |
note:added |
Server → Client | { conversationId, note, mentionedUsers } | Private note added with @mentions |
contact:updated |
Server → Client | { contactId, updates } | Contact attributes updated |
conversation:viewing |
Client → Server | { conversationId } | User opened conversation (collision detection) |
conversation:viewers |
Server → Client | { conversationId, viewers: [] } | List of users currently viewing conversation |
Note: Presence data stored in Redis (ephemeral), not PostgreSQL
UnifiedBeez_UI_UX/Live Dashboard UI - Inbox/General Inbox - Whatsapp Chat.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Create new chat.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Team Inbox.pngUnifiedBeez_UI_UX/Live Dashboard UI - Inbox/Team Inbox - Info Open.pngUnifiedBeez_UI_UX/Automations Library + Email Builder _All pictures/Chatbox.pngUnifiedBeez_UI_UX/Onboarding & Manual Setup/Onboarding & Manual Setup - Onboarding Flow Step 4 - AI Assistant Creation/Onboarding Flow - Step 4_ Settings, Live Preview Chatbox.pngUnifiedBeez_UI_UX/Onboarding & Manual Setup/Onboarding & Manual Setup - Webchat Connection/Manual Setup Step 7_ Webchat Connection.pngThe Multi-Channel Routing system provides a unified abstraction layer for sending and receiving messages across 6+ communication channels (WhatsApp, Email, Instagram, Facebook Messenger, Telegram, SMS). Each channel has a dedicated adapter that normalizes incoming messages to a common format, handles channel-specific constraints (24-hour windows, rate limits), and routes messages to the appropriate external API. This architecture enables UnifiedBeez to add new channels without modifying core business logic.
Responsibility: Orchestrate channel adapters and message routing
Key Methods:
sendMessage(channel, to, content, options) - Route outbound message to appropriate adapterreceiveMessage(channel, rawPayload) - Process inbound message from webhookgetChannelStatus(channelId) - Check channel connection healthretryFailedMessage(messageId) - Retry failed message deliveryhandleWebhook(channel, payload, signature) - Verify and process webhooksResponsibility: Normalize and route messages
Key Methods:
normalizeIncoming(channel, rawMessage) - Convert to UnifiedBeez message formatnormalizeOutgoing(channel, unifiedMessage) - Convert to channel-specific formatvalidateChannelConstraints(channel, message) - Check 24-hour window, rate limits, etc.selectAdapter(channel) - Return appropriate adapter instanceEach channel adapter implements a common interface:
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /api/channels |
Get all connected channels | - |
| POST | /api/channels/whatsapp |
Connect WhatsApp Business API | { phoneNumberId, accessToken, wabaId } |
| POST | /api/channels/email |
Connect email (SMTP/IMAP) | { email, smtpHost, imapHost, credentials } |
| POST | /api/channels/social |
Connect Instagram/Facebook Messenger | { platform, pageId, accessToken } |
| POST | /api/channels/telegram |
Connect Telegram bot | { botToken } |
| POST | /api/channels/sms |
Connect Twilio SMS | { accountSid, authToken, phoneNumber } |
| DELETE | /api/channels/:id |
Disconnect channel | - |
| POST | /api/webhooks/whatsapp |
WhatsApp webhook receiver | Meta webhook payload |
| POST | /api/webhooks/instagram |
Instagram webhook receiver | Instagram Graph API payload |
| GET | /api/channels/:id/health |
Check channel connection health | - |