Skip to main content

CHAT API Reference

Module Information​

Service Files:

  • Private: service/private/chat.js

Available Services: 16 Documented Services: 16


chat.acknowledge​

Mark a P2P conversation as read. Advances the read cursor (ref_ctime) for the conversation with the specified peer. No longer requires a specific message_id — acknowledges up to the current timestamp or a supplied ref_ctime.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.acknowledge

Parameters​

ParameterTypeRequiredDefaultDescription
peer_idstringYes--
ref_ctimeintegerNo--

Returns​

FieldTypeDescription
typeany-
descriptionany-
propertiesany-

Possible Errors​

Error codes not documented


chat.attachment​

Get attachments for a specific message with pagination. Returns media files attached to a message, with 5 items per page. Each attachment includes full file metadata.

PropertyValue
ScopeHub (requires hub context)
PermissionRead (2)

Endpoint:

https://hostname/-/svc/chat.attachment

Parameters​

ParameterTypeRequiredDefaultDescription
message_idstringYes--
pageintegerNo1-

Returns​

FieldTypeDescription
typeany-
descriptionany-
itemsobject-
items.nidstring-
items.hub_idstring-
items.file_namestring-
items.filesizeinteger-
items.extensionstring-
items.categorystring-
items.privilegeinteger-
items.pageinteger-

Possible Errors​

Error codes not documented


chat.chat_rooms​

List chat rooms with filtering and pagination. Returns paginated list of chat rooms with optional filtering by tag, keyword, flag, and status (active/archived).

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.chat_rooms

Parameters​

ParameterTypeRequiredDefaultDescription
tag_idstringNo""-
pageintegerNo1-
keystringNo""-
flagstringNo""-
optionstringNo"active"-

Returns​

FieldTypeDescription
typeany-
descriptionany-
itemsobject-
items.entity_idstring-
items.contact_idstring-
items.firstnamestring-
items.lastnamestring-
items.last_messagestring-
items.unread_countinteger-
items.last_activityinteger-

Possible Errors​

Error codes not documented


chat.chat_room_info​

Get detailed information about a specific chat room. Returns complete metadata and current status of a chat room identified by key.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.chat_room_info

Parameters​

ParameterTypeRequiredDefaultDescription
keystringYes--

Returns​

FieldTypeDescription
typeany-
descriptionany-
propertiesany-

Possible Errors​

Error codes not documented


chat.change_status​

Change chat room status (archive or unarchive). Archives or restores a chat conversation. Triggers WebSocket notification to update UI across all user sessions.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.change_status

Parameters​

ParameterTypeRequiredDefaultDescription
entity_idstringYes--
statusstringYes--

Returns​

FieldTypeDescription
typeany-
descriptionany-
propertiesany-

Possible Errors​

Error CodeHTTP StatusDescription
INVALID_STATUS0-Status must be 'archived' or 'active'

chat.contact_rooms​

List chat rooms filtered by contacts. Returns chat rooms specifically for direct contact conversations (not group chats), with optional tag and keyword filtering.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.contact_rooms

Parameters​

ParameterTypeRequiredDefaultDescription
tag_idstringNo""-
pageintegerNo1-
keystringNo""-

Returns​

FieldTypeDescription
typeany-
descriptionany-
itemsobject-
items.entity_idstring-
items.contact_idstring-
items.firstnamestring-
items.lastnamestring-
items.last_messagestring-
items.unread_countinteger-

Possible Errors​

Error codes not documented


chat.count_all​

Get unread message counts across all chat categories. Returns breakdown by contact P2P chats, shared hub chats, archived chats, and support tickets.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.count_all

Parameters​

No parameters

Returns​

FieldTypeDescription
typeany-
descriptionany-
propertiesany-

Possible Errors​

Error codes not documented


chat.delete​

Delete messages from a P2P or hub chat. For P2P: pass peer_id to activate the P2P delete path — 'me' soft-deletes from sender DB, 'all' deletes from both sides via cross-DB. For hub chat: omit peer_id (legacy path). Option 'all' requires user to be the message author.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.delete

Parameters​

ParameterTypeRequiredDefaultDescription
optionstringYes--
messagesarray<string>Yes--
peer_idstringNo--

Returns​

FieldTypeDescription
typeany-
descriptionany-
itemsobject-
items.message_idstring-

Possible Errors​

Error CodeHTTP StatusDescription
INVALID_OPTION-Option must be 'me' or 'all'
INVALID_MESSAGES-One or more message IDs do not exist

chat.forward​

Forward messages to multiple recipients. Takes existing messages and sends copies to specified entities. Preserves original message content and attachments. Supports bulk forwarding.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.forward

Parameters​

ParameterTypeRequiredDefaultDescription
entitiesarray<string>Yes--
nodesobjectYes--

Returns​

FieldTypeDescription
typeany-
descriptionany-
itemsobject-
items.message_idstring-
items.entity_idstring-
items.forward_message_idstring-
items.author_idstring-
items.is_attachmentinteger-

Possible Errors​

Error codes not documented


chat.messages​

Get paginated message list for a P2P conversation. Returns messages from both sides of the conversation (sent and received), merged and sorted by ctime descending. Automatically advances the read cursor. Notifies message authors via WebSocket that their messages were seen.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.messages

Parameters​

ParameterTypeRequiredDefaultDescription
entity_idstringYes--
pageintegerNo1-

Returns​

FieldTypeDescription
typeany-
descriptionany-
itemsobject-
items.sys_idinteger-
items.peer_idstring-
items.message_idstring-
items.author_idstring-
items.messagestring-
items.ctimeinteger-
items.is_readedinteger-
items.is_seeninteger-
items.is_notifyinteger-
items.is_attachmentinteger-
items.attachment_firstobject-
items.attachment_countinteger-
items.mention_idsarray-
items.message_typestring-
items.thread_idstring-
items.is_forwardinteger-
items.metadataobject-
items.entityobject-
items.threadobject-

Possible Errors​

Error codes not documented


chat.post​

Send a P2P message to a contact. Message is stored in sender's DB only (single-write). Peer's conversation list (p2p_time) is updated cross-DB. Both sender and recipient are notified via WebSocket.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.post

Parameters​

ParameterTypeRequiredDefaultDescription
entity_idstringYes--
messagestringNo""-
thread_idstringNo--
attachmentarray<string>No[]-

Returns​

FieldTypeDescription
typeany-
descriptionany-
itemsobject-
items.sys_idinteger-
items.peer_idstring-
items.message_idstring-
items.author_idstring-
items.to_idstring-
items.messagestring-
items.ctimeinteger-
items.is_attachmentinteger-
items.message_typestring-
items.is_readedinteger-
items.is_seeninteger-
items.entityobject-
items.threadobject-
items.roominteger-
items.totalinteger-
items.echoIdstring-

Possible Errors​

Error CodeHTTP StatusDescription
INVALID_CONTACT-Contact does not exist or is invalid
INVALID_ATTACHMENT-One or more attachments are invalid or inaccessible
INVALID_THREAD-Thread ID does not exist

chat.share_rooms​

List group/shared chat rooms. Returns chat rooms for group conversations (not direct contact chats), with optional keyword filtering and pagination.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.share_rooms

Parameters​

ParameterTypeRequiredDefaultDescription
pageintegerNo1-
keystringNo""-

Returns​

FieldTypeDescription
typeany-
descriptionany-
itemsobject-
items.entity_idstring-
items.group_namestring-
items.last_messagestring-
items.unread_countinteger-
items.member_countinteger-

Possible Errors​

Error codes not documented


chat.tag_chat_count​

Get chat count for a specific tag. Returns the number of chat rooms associated with a contact tag.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.tag_chat_count

Parameters​

ParameterTypeRequiredDefaultDescription
tag_idstringYes--

Returns​

FieldTypeDescription
typeany-
descriptionany-
itemsobject-
items.tag_idstring-
items.tag_namestring-
items.chat_countinteger-

Possible Errors​

Error codes not documented


chat.to_read​

Get number of unread message pages for a contact. Returns how many pages of unread messages exist in a conversation. Used for pagination UI indicators.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.to_read

Parameters​

ParameterTypeRequiredDefaultDescription
entity_idstringYes--

Returns​

FieldTypeDescription
typeany-
descriptionany-
propertiesany-

Possible Errors​

Error CodeHTTP StatusDescription
INVALID_CONTACT-Contact does not exist or is invalid

chat.upload_remove​

Remove an uploaded attachment before sending. Deletes a file from chat upload directory. Only works on files in /chat/upload/ path. File must be owned by user and cannot be a folder or hub.

PropertyValue
ScopeHub (requires hub context)
PermissionWrite (8)

Endpoint:

https://hostname/-/svc/chat.upload_remove

Parameters​

ParameterTypeRequiredDefaultDescription
nidstringYes--

Returns​

FieldTypeDescription
typeany-
descriptionany-
propertiesany-

Possible Errors​

Error CodeHTTP StatusDescription
INVALID_ATTACHMENT-File does not exist
INVALID_ATTACHMENT-File is not in chat upload directory (/chat/upload/)
INVALID_ATTACHMENT-Cannot delete folders or hubs

chat.typing​

Broadcast an ephemeral typing indicator to a P2P chat peer over WebSocket. Nothing is persisted; the indicator is rendered transiently in the peer's chat widget.

PropertyValue
ScopeHub (requires hub context)
PermissionRead (2)

Endpoint:

https://hostname/-/svc/chat.typing

Parameters​

ParameterTypeRequiredDefaultDescription
entity_idstringYes--
statenumberNo1-

Returns​

FieldTypeDescription
typeany-
descriptionany-

Possible Errors​

Error codes not documented