Overview
The Communications Service (Comms Service) provides real-time messaging and collaboration features for Macro. It manages channels, direct messages, message threads, and real-time notifications via WebSocket connections. Base URL:/comms
Authentication: JWT authentication required via the Authorization header.
Core Concepts
Channels
Channels are conversation spaces that can be:- Direct Messages (DM): 1-on-1 conversations between two users
- Private: Invitation-only group conversations
- Organization: Company-wide or team channels
- Participant list
- Message history
- Typing indicators
- Read receipts
- Activity tracking
Messages
Messages support:- Rich text content
- User mentions (
@user) - Document/entity attachments
- Reactions (emoji)
- Threading (replies to messages)
- Real-time delivery via WebSocket
Participants
Users who are members of a channel. Participants can:- Send and receive messages
- Add/remove other participants (based on permissions)
- Leave channels
- See typing indicators
Channels
Create Channel
Channel name (optional for DMs, required for other types)
Channel type:
dm, private, or organizationArray of participant user IDs (must start with “macro|”)
Created channel ID (UUID)
Participants are automatically filtered to only include valid Macro user IDs. At least one participant is required.
Get or Create DM
User ID to start/find DM with
Channel ID
Whether a new channel was created
Get or Create Private Channel
Array of participant user IDs
Channel name (if creating)
Get Channel
Channel ID
Number of messages to return (default: 50)
Message ID to fetch messages before (for pagination)
Channel ID
Channel name
Channel type
Array of participant objects
Recent messages in the channel
Channel creation time
Last message time
Update Channel
Channel ID
New channel name
Channel description
Delete Channel
Channel ID
Join Channel
Channel ID
Leave Channel
Add Participants
Channel ID
Array of user IDs to add
Remove Participants
Channel ID
Array of user IDs to remove
Get Channel Metadata
Get Channel Transcript
Channel ID
Export format:
json, txt, html (default: json)Messages
Post Message
Channel ID
Message content (supports markdown)
Array of mention objects
Array of attachment objects (documents, links, etc.)
Parent message ID if replying in a thread
Client-generated nonce for deduplication
Created message ID
Echo back the nonce for client correlation
Messages are delivered in real-time to all channel participants via WebSocket. The service also handles:
- Updating channel share permissions for attached documents
- Sending notifications to mentioned users
- Indexing the message for search
- Updating channel activity tracking
Update Message
Channel ID
Message ID
Updated message content
Delete Message
Post Reaction
Channel ID
Message ID to react to
Emoji character or code
Post Typing Indicator
Channel ID
Whether user is currently typing
Get Message with Context
Message ID
Number of messages before/after to include (default: 10)
Mentions
Get Mentions
Channel ID
Attachments
Get Attachment References
Entity ID (e.g., document ID)
Entity type (e.g., “document”)
Array of channel IDs where the entity is referenced
Activity
Post Activity
Type of activity:
view, interact, typingChannel ID (for channel-specific activity)
Error Codes
Common Errors
200- Success201- Created400- Bad Request (invalid participants, empty content)401- Unauthorized (not a channel member)404- Channel or message not found500- Internal Server Error
Service-Specific Errors
INVALID_PARTICIPANTS- Participants list is empty or contains invalid user IDsNOT_CHANNEL_MEMBER- User is not a member of the channelCHANNEL_ARCHIVED- Cannot perform action on archived channelMESSAGE_TOO_LONG- Message exceeds maximum lengthPERMISSION_DENIED- User lacks permission for this action