Messaging Chat Interface
On this page
A modern, chat-like messaging interface for Frappe Communications, powered by vue-advanced-chat.
Features
Unified Inbox: View all Email and SMS communications in one chat-like interface
Real-time Updates: Messages update in real-time using Frappe's realtime system
Dark Mode Support: Automatically adapts to Frappe's theme settings
Contact Integration: Links to Frappe Contact records for quick access
Reference Documents: View and link to related Frappe documents
File Attachments: Send and receive file attachments
Search: Search across all conversations
Medium Filter: Filter by Email, SMS, or all messages
Architecture
Backend (Python)
The backend API is located in messaging/messaging/api/chat/:
types.py: TypedDict definitions matching vue-advanced-chat structuresapi.py: Whitelist API endpoints using Frappe Query Builderget_rooms(): Get conversation threads (grouped by sender/recipient)get_messages(): Get messages for a specific conversationsend_message(): Send email or SMS messagesmark_messages_seen(): Mark messages as readget_current_user(): Get current user info for chatsearch_rooms(): Search conversationsget_unread_count(): Get total unread message countarchive_room(),delete_room(): Close or delete every message of a conversation
Frontend (TypeScript/Vue)
The frontend is located in messaging/public/js/chat/:
types.ts: TypeScript interfaces for vue-advanced-chat and Frappeapi.ts: Typed API client for backend callsuseChat.ts: Vue composable for state managementChatView.vue: Main chat component using vue-advanced-chatchat.bundle.ts: Frappe view integration
Installation
The chat interface is included with the messaging app. After installing:
cd frappe-bench
bench --site yoursite install-app messaging
bench build --app messaging
bench migrateWho can use it
The chat shows every Communication on the site, so it is for users whose role can read all of them, not only their own:
System Manager can do everything.
Inbox User can read conversations (which marks them seen), send messages and delete conversations, but not archive them: archiving changes the messages, which needs write permission on Communication.
Other users, Website Users among them, are refused. New-message notifications, live and push, reach only the users who can read the conversations.
Usage
Navigate to Communication in Frappe desk
The default view is now the Chat interface; the view switcher offers it as Chat View
Use the medium filter to show Email, SMS, or all messages
Click a conversation to view and reply to messages
Use the "New Message" button to start a new conversation
Configuration
No additional configuration is required. The chat interface uses existing Frappe Communication and SMS settings.
API Reference
get_rooms
get_rooms(
page: int = 1,
limit: int = 20,
search: str = "",
medium: str = "All"
) -> RoomsResponseget_messages
get_messages(
room_id: str,
page: int = 1,
limit: int = 50,
before_id: str = ""
) -> MessagesResponsesend_message
send_message(
room_id: str,
content: str,
files: list[dict] | None = None,
reply_message_id: str = "",
subject: str = ""
) -> SendMessageResponseRoom ID Format
Room IDs follow the pattern: {medium}:{identifier}[:ref_dt:ref_name]
Examples:
SMS:+15551234567- SMS conversation with a phone numberEmail:user@example.com- Email thread with an email addressEmail:user@example.com:Lead:LEAD-00001- Email linked to a Lead
Type Definitions
See messaging/messaging/api/chat/types.py for Python types and messaging/public/js/chat/types.ts for TypeScript interfaces.
Development
Building
cd frappe-bench/apps/messaging
yarn install
bench build --app messagingType Checking
yarn typecheckWatch Mode
yarn watchContributing
Contributions are welcome! Please ensure:
Python code uses type annotations
TypeScript code is properly typed
Use Frappe Query Builder for all database operations
Follow vue-advanced-chat patterns for frontend components