Omni-Channel Messaging
Send and receive WhatsApp and SMS messages from a unified inbox with AI-assisted replies and automation support.
CRM Factory provides a unified messaging experience across WhatsApp and SMS. Inbound messages are handled by an AI agent first, with seamless handoff to human agents when needed.
Conversations Inbox
The Conversations page is the central hub for all messaging threads. Each conversation shows:
- Channel — WhatsApp or SMS badge
- Status —
active,waiting_reply,needs_human,completed, orexpired - Intent and summary — AI-generated context
- Message count and recency
Conversations auto-refresh every 10 seconds. Open a thread to see the full message history with distinct bubbles for customer, AI, and agent messages.
Replying as an Agent
Click any active thread to open the composer. Replies go out on the same channel the customer used — if they messaged via WhatsApp, your reply sends via WhatsApp. Type your message and press Enter or click Send.
You can also reply from a Contact record without leaving the contact detail page — the conversations panel is embedded directly on the contact view.
Channels
WhatsApp conversations use Twilio's Messaging API with support for:
- Plain text messages with optional media attachments
- Template messages — Pre-approved templates for welcome menus, order confirmations, and part selection lists
- Interactive buttons — Quick-reply buttons and list pickers (up to 10 items)
- 24-hour session window — WhatsApp requires template messages outside the session window
Template messages are managed via Twilio Content SIDs. Default templates are built in; override them with TWILIO_TPL_* environment variables for account-specific templates.
SMS
SMS conversations use Twilio's REST API with support for:
- Plain text messages
- MMS attachments — Inbound images are processed with AI vision and merged into the conversation context
- 4-hour session window — Shorter than WhatsApp to reflect the synchronous nature of SMS
- Delivery status tracking — Real-time delivery receipts via Twilio status callbacks
Session Management
Each conversation creates a session that tracks channel, customer address, status, intent, order context, and assignment. Sessions expire based on channel-specific timeouts:
| Channel | Session Window |
|---|---|
| 24 hours | |
| SMS | 4 hours |
| Voice | 30 minutes |
Expired sessions are closed automatically. New inbound messages create a fresh session.
AI Agent
Inbound messages are first handled by an AI conversation agent that can:
- Greet customers and understand intent
- Look up orders, pricing, and inventory from connected ERP systems
- Build order drafts interactively
- Escalate to human agents when confidence is low or the customer requests it
The AI agent runs within the session context, carrying forward the full conversation history, customer information, and any in-progress order draft.
Automation Integration
Messaging integrates with the workflow automation builder:
Triggers
| Trigger | Description |
|---|---|
sms_received | Fires when an inbound SMS arrives |
channel_message_received | Fires on any inbound message; filter by channel (sms, whatsapp, email, voicemail, mms) |
Actions
| Action | Description |
|---|---|
send_sms | Send an SMS to a specified number with a template body |
channel_notify | Send a message on a specific channel (sms, whatsapp, email) or the originating channel from the trigger. Supports template variables like {{order_number}} and {{status}} |
There is no separate "send WhatsApp" step — use channel_notify with channel: "whatsapp" or channel: "originating" to reply on whatever channel the customer used.
API
List Conversations
GET /api/v1/conversationsReturns active conversation sessions for the authenticated org. Filter by sessionId or contactId.
Get Conversation Stats
GET /api/v1/conversations/statsReturns aggregate metrics: total conversations, AI resolution ratio, averages by channel and intent.
Reply to a Conversation
POST /api/v1/conversations/reply
Content-Type: application/json
{
"sessionId": "ses_abc123",
"message": "Your order has shipped — tracking number is XYZ789."
}The reply is sent on the same channel as the session and the session status updates to waiting_reply.
Message Templates
GET /api/v1/message-templates
POST /api/v1/message-templatesManage org-level message templates with channel, body, variables, optional Twilio Content SID, and approval status.
Configuration
Set the following environment variables to enable messaging:
| Variable | Description |
|---|---|
PLATFORM_TWILIO_ACCOUNT_SID | Twilio account SID |
PLATFORM_TWILIO_AUTH_TOKEN | Twilio auth token |
PLATFORM_TWILIO_SMS_NUMBER | Twilio number for SMS |
PLATFORM_TWILIO_WHATSAPP_NUMBER | Twilio number for WhatsApp (e.g. whatsapp:+1...) |
TWILIO_TPL_* | Optional template Content SID overrides |
CONVERSATION_ESCALATION_QUEUE_* | Queue routing for human handoff |
Configure the Twilio webhook URL to point at your deployment:
https://your-domain.com/api/v1/webhooks/telephony/smsThis single endpoint handles both SMS and WhatsApp inbound messages — the channel is detected automatically from the sender address format.