Mirra Messaging
SDK reference for mirra messaging operations
Overview
Send messages through Mirra platform with automation metadata tracking
- Category:
communication - Auth Required: No
- Supported Modes: standard, delegated, service
Operations
sendMessage
Send a message to a group (including direct chats). The message is sent as the authenticated user with optional automation metadata. Returns normalized flat structure.
Arguments:
groupId(string, required): Group ID to send the message to (use getContacts or getGroups to get the groupId)content(string, required): Message text contentautomation(object, optional): Automation metadata: { source: string, flowId?: string, flowTitle?: string, sessionId?: string, isAutomated?: boolean }. Use sessionId to group related messages and enable Flow-based reply routing.structuredData(array, optional): Structured data for rich UI rendering: [{ displayType, templateId, data, metadata?, interactions? }]
Returns:
AdapterOperationResult - Returns FLAT structure with: messageId, chatInstanceId, groupId, content, timestamp, automationSource, automationSessionId, automationFlowId, linkUrl, linkLabel. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
messageId | string | Sent message ID |
chatInstanceId | string | Chat instance ID |
groupId | string | Group ID |
content | string | Message content |
timestamp | string | Sent timestamp (ISO 8601) |
automationSource | `string | null` |
automationSessionId | `string | null` |
automationFlowId | `string | null` |
linkUrl | string | Deep link URL to chat |
linkLabel | string | Display label for link |
Example:
updateMessage
Update an existing message sent by the authenticated user. Returns normalized flat structure.
Arguments:
messageId(string, required): ID of the message to updatecontent(string, required): New message text contentstructuredData(array, optional): Updated structured data for rich UI rendering
Returns:
AdapterOperationResult - Returns FLAT structure with: messageId, chatInstanceId, groupId, content, editedAt, editCount. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
messageId | string | Updated message ID |
chatInstanceId | string | Chat instance ID |
groupId | string | Group ID |
content | string | Updated message content |
editedAt | string | Edit timestamp (ISO 8601) |
editCount | number | Total edit count |
Example:
getContacts
Get list of accepted contacts for the user. Returns normalized flat structures.
Arguments:
limit(number, optional): Maximum number of contacts to return (default 50)offset(number, optional): Offset for pagination (default 0)
Returns:
AdapterOperationResult - Returns { contacts[], totalCount, limit, offset, hasMore }. Each contact has FLAT fields: contactId, userId, username, profilePhoto, groupId, isContact. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
contacts | MirraMessagingContact[] | List of contacts |
contacts item fields (MirraMessagingContact)
| Field | Type | Description |
|---|---|---|
contactId | string | Contact record ID |
userId | string | User ID |
username | string | Username |
profilePhoto | `string | null` |
groupId | `string | null` |
isContact | boolean | Whether user is a contact |
| totalCount | number | Total available contacts |
| limit | number | Items per page |
| offset | number | Current offset |
| hasMore | boolean | Whether more items exist |
Example:
findContact
Find a contact by username or partial name match. Returns normalized flat structures.
Arguments:
query(string, required): Username or name to search for
Returns:
AdapterOperationResult - Returns { contacts[], users[], query, contactCount, userCount }. Each entry has FLAT fields: contactId, userId, username, profilePhoto, groupId, isContact. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
contacts | MirraMessagingContact[] | Matching contacts |
contacts item fields (MirraMessagingContact)
| Field | Type | Description |
|---|---|---|
contactId | string | Contact record ID |
userId | string | User ID |
username | string | Username |
profilePhoto | `string | null` |
groupId | `string | null` |
isContact | boolean | Whether user is a contact |
| users | MirraMessagingContact[] | Matching non-contact users |
users item fields (MirraMessagingContact)
| Field | Type | Description |
|---|---|---|
contactId | string | Contact record ID |
userId | string | User ID |
username | string | Username |
profilePhoto | `string | null` |
groupId | `string | null` |
isContact | boolean | Whether user is a contact |
| query | string | Search query used |
| contactCount | number | Number of matching contacts |
| userCount | number | Number of matching users |
Example:
getChats
Get list of chat instances for the user. Returns normalized flat structures.
Arguments:
scope(string, optional): Filter by scope: direct, user, group, or all (default all)limit(number, optional): Maximum number of chats to return (default 50)
Returns:
AdapterOperationResult - Returns { chats[], count }. Each chat has FLAT fields: chatInstanceId, title, scope, lastMessageAt, lastMessagePreview, messageCount, peerUserId, peerUsername, peerProfilePhoto, groupId, groupName, groupProfileImage. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
chats | MirraMessagingChat[] | List of chat instances |
chats item fields (MirraMessagingChat)
| Field | Type | Description |
|---|---|---|
chatInstanceId | string | Chat instance ID |
title | string | Chat title |
scope | ``'direct' | 'user' |
lastMessageAt | `string | null` |
lastMessagePreview | `string | null` |
messageCount | number | Total message count |
peerUserId | `string | null` |
peerUsername | `string | null` |
peerProfilePhoto | `string | null` |
groupId | `string | null` |
groupName | `string | null` |
groupProfileImage | `string | null` |
| count | number | Number of chats returned |
Example:
getGroups
Get list of groups the user is a member of. Returns normalized flat structures.
Arguments:
limit(number, optional): Maximum number of groups to return (default 50)
Returns:
AdapterOperationResult - Returns { groups[], count }. Each group has FLAT fields: groupId, name, description, profileImage, role, joinedAt. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
groups | MirraMessagingGroup[] | List of groups |
groups item fields (MirraMessagingGroup)
| Field | Type | Description |
|---|---|---|
groupId | string | Group ID |
name | string | Group name |
description | `string | null` |
profileImage | `string | null` |
role | string | User role in group |
joinedAt | string | Join timestamp (ISO 8601) |
| count | number | Number of groups returned |
Example:
createGroup
Create a new group. The authenticated user becomes the group owner. Returns normalized flat structure.
Arguments:
name(string, required): Group name (max 100 characters)description(string, optional): Group description (max 500 characters)category(string, optional): Category for organization: "family", "friends", "work", or "other" (default: "other")memberIds(array, optional): Array of user IDs to add as initial members
Returns:
AdapterOperationResult - Returns FLAT structure with: groupId, chatInstanceId, name, description, category, createdBy, memberCount, createdAt, linkUrl, linkLabel. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
groupId | string | Created group ID |
chatInstanceId | string | Chat instance ID |
name | string | Group name |
description | `string | null` |
category | string | Group category |
createdBy | string | Creator user ID |
memberCount | number | Initial member count |
createdAt | string | Creation timestamp (ISO 8601) |
linkUrl | string | Deep link URL to group chat |
linkLabel | string | Display label for link |
Example:
searchMessages
Search chat messages by keywords. Returns summaries by default to avoid overwhelming context. Use includeFullText for complete messages.
Arguments:
query(string, required): Keywords to search forcontactName(string, optional): Contact name to filter by sender (resolved to userId)groupName(string, optional): Group name to limit search (resolved to groupId)groupId(string, optional): Group ID to limit search (use groupName for name-based lookup)scope(string, optional): "direct", "group", or "all" (default)startDate(string, optional): ISO date for time range startendDate(string, optional): ISO date for time range endincludeFullText(boolean, optional): Include full message text (default: false, returns snippets)snippetLength(number, optional): Max chars for snippet (default: 200)limit(number, optional): Max results (default 20, max 50)offset(number, optional): Pagination offset
Returns:
AdapterOperationResult - Returns { messages[], totalCount, limit, offset, hasMore, query, summaryMode }. Each message has FLAT fields: messageId, chatInstanceId, groupId, groupName, senderId, senderUsername, snippet, text (if includeFullText), timestamp, scope, relevanceScore, isFromMe, chatType, messageLength. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
messages | MirraMessagingSearchMessage[] | Matching messages |
messages item fields (MirraMessagingSearchMessage)
| Field | Type | Description |
|---|---|---|
messageId | string | Message ID |
chatInstanceId | string | Chat instance ID |
groupId | `string | null` |
groupName | `string | null` |
senderId | string | Sender user ID |
senderUsername | string | Sender username |
snippet | string | Message snippet around matched keywords |
text | `string | null` |
timestamp | string | Message timestamp (ISO 8601) |
scope | ``'direct' | 'group'`` |
relevanceScore | number | Search relevance score |
isFromMe | boolean | Whether message is from authenticated user |
chatType | ``'direct' | 'group'`` |
messageLength | number | Full message length in characters |
| totalCount | number | Total matching messages |
| limit | number | Items per page |
| offset | number | Current offset |
| hasMore | boolean | Whether more results exist |
| query | string | Search query used |
| summaryMode | boolean | Whether results are in summary mode |
Example: