Omnix

UnifiedInboxRpc

UnifiedInboxRpc exposes the JSON-RPC methods used by the unified inbox area to load conversations, fetch interactions, send messages, manage assignment and status, work with internal notes, and retrieve a recordings playback key. The methods below are derived from the file’s @rpcMethod metadata and the service calls visible in src/server/rpc/UnifiedInboxRpc.js.

Endpoints

POST /api/rpc (Method: UnifiedInboxRpc.getConversations)

Retrieves the list of conversations for the current user.

Request Body:

{
  "method": "UnifiedInboxRpc.getConversations",
  "params": {
    "page": 1,
    "pageSize": 50,
    "filter": {
      "channel": "sms",
      "status": "open",
      "assigneeId": null,
      "tag": "vip"
    }
  }
}

Parameters:

Name Type Required Description
page Number No Page number. Defaults to 1.
pageSize Number No Number of conversations per page. Defaults to 50.
filter Object No Optional filter object.
filter.channel String No Channel type filter. May be null.
filter.status String | Object No Conversation status filter. May be a string or an object containing an $in array of strings. May be null.
filter.assigneeId String No Assignee filter. May be null.
filter.tag String No Tag filter. May be null.

Response:

{
  "success": true,
  "data": {
    "data": [
      {
        "_id": "conversation-id",
        "contactId": "contact-id",
        "contact": {},
        "unreadCount": 0
      }
    ],
    "totalCount": 0
  }
}

The method returns the service result from UnifiedInboxService.getConversations(...). The file confirms that the RPC passes context.userId, context.subscriptionId, and the requested paging/filter options to the service.

Example (cURL):

curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "UnifiedInboxRpc.getConversations",
    "params": {
      "page": 1,
      "pageSize": 50,
      "filter": {
        "channel": "sms"
      }
    }
  }'

POST /api/rpc (Method: UnifiedInboxRpc.getAssignableAgents)

Retrieves a list of contacts that can be assigned to conversations.

Request Body:

{
  "method": "UnifiedInboxRpc.getAssignableAgents",
  "params": {}
}

Parameters:

Name Type Required Description
None This method accepts an empty object.

Response:

{
  "success": true,
  "data": [
    {
      "value": "user-id",
      "label": "username",
      "icon": "bi-person-fill"
    }
  ]
}

The RPC forwards context.subscriptionId to UnifiedInboxService.getAssignableAgents(...).

Example (cURL):

curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "UnifiedInboxRpc.getAssignableAgents",
    "params": {}
  }'

POST /api/rpc (Method: UnifiedInboxRpc.getInteractions)

Retrieves the full interaction history for a specific conversation.

Request Body:

{
  "method": "UnifiedInboxRpc.getInteractions",
  "params": {
    "conversationId": "conversation-id",
    "page": 1,
    "pageSize": 50
  }
}

Parameters:

Name Type Required Description
conversationId String Yes Conversation identifier.
page Number No Page number. Defaults to 1.
pageSize Number No Number of interactions per page. Defaults to 50.

Response:

{
  "success": true,
  "data": {
    "data": [
      {
        "_id": "interaction-id",
        "conversationId": "conversation-id"
      }
    ],
    "totalCount": 0
  }
}

The RPC passes the full context object to UnifiedInboxService.getInteractions(...), along with paging options.

Example (cURL):

curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "UnifiedInboxRpc.getInteractions",
    "params": {
      "conversationId": "conversation-id",
      "page": 1,
      "pageSize": 50
    }
  }'

POST /api/rpc (Method: UnifiedInboxRpc.sendMessage)

Sends a message from the current user to a conversation.

Request Body:

{
  "method": "UnifiedInboxRpc.sendMessage",
  "params": {
    "conversationId": "conversation-id",
    "channelType": "sms",
    "content": {},
    "attachments": [
      {
        "fileId": "file-id",
        "fileName": "attachment.png",
        "mimeType": "image/png"
      }
    ],
    "clientTempId": "temp-id"
  }
}

Parameters:

Name Type Required Description
conversationId String Yes Conversation identifier.
channelType String Yes Channel type for the outbound message.
content Any Yes Message payload.
attachments Array<Object> No Optional uploaded file references provided by the client.
attachments[].fileId String Yes The unique path or ID of the uploaded file.
attachments[].fileName String Yes The original name of the file.
attachments[].mimeType String Yes The MIME type of the file.
clientTempId String No Optional client-side temporary message identifier.

Response:

{
  "success": true,
  "data": {
    "_id": "interaction-id"
  }
}

The RPC passes context.userId, the conversation data, channel information, content, attachments, the full context, and clientTempId to UnifiedInboxService.sendMessage(...). The service implementation shown in src/server/services/UnifiedInboxService.js creates an outbound interaction and broadcasts it after routing the message.

Example (cURL):

curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "UnifiedInboxRpc.sendMessage",
    "params": {
      "conversationId": "conversation-id",
      "channelType": "sms",
      "content": {
        "text": "Hello"
      }
    }
  }'

POST /api/rpc (Method: UnifiedInboxRpc.assignConversation)

Assigns a conversation to a user.

Request Body:

{
  "method": "UnifiedInboxRpc.assignConversation",
  "params": {
    "conversationId": "conversation-id",
    "assigneeId": "user-id"
  }
}

Parameters:

Name Type Required Description
conversationId String Yes Conversation identifier.
assigneeId String Yes User identifier to assign the conversation to. May be null.

Response:

{
  "success": true,
  "data": null
}

The RPC forwards the request to UnifiedInboxService.assignConversation(...) together with the current context.

Example (cURL):

curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "UnifiedInboxRpc.assignConversation",
    "params": {
      "conversationId": "conversation-id",
      "assigneeId": "user-id"
    }
  }'

POST /api/rpc (Method: UnifiedInboxRpc.updateConversationStatus)

Updates the status of a conversation.

Request Body:

{
  "method": "UnifiedInboxRpc.updateConversationStatus",
  "params": {
    "conversationId": "conversation-id",
    "status": "open"
  }
}

Parameters:

Name Type Required Description
conversationId String Yes Conversation identifier.
status String Yes New status. Allowed values are open, pending, and closed.

Response:

{
  "success": true,
  "data": null
}

The RPC passes the update to UnifiedInboxService.updateConversationStatus(...) with the current context.

Example (cURL):

curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "UnifiedInboxRpc.updateConversationStatus",
    "params": {
      "conversationId": "conversation-id",
      "status": "closed"
    }
  }'

POST /api/rpc (Method: UnifiedInboxRpc.sendTypingIndicator)

Broadcasts a typing indicator for a conversation.

Request Body:

{
  "method": "UnifiedInboxRpc.sendTypingIndicator",
  "params": {
    "conversationId": "conversation-id",
    "isTyping": true
  }
}

Parameters:

Name Type Required Description
conversationId String Yes Conversation identifier.
isTyping Boolean Yes Typing state to broadcast.

Response:

{
  "success": true,
  "data": {
    "success": true
  }
}

The RPC awaits UnifiedInboxService.handleTypingIndicator(...) and then returns { success: true }.

Example (cURL):

curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "UnifiedInboxRpc.sendTypingIndicator",
    "params": {
      "conversationId": "conversation-id",
      "isTyping": true
    }
  }'