Skip to content

Chat Messages

List of valid attributes:

AttributeDescriptionSpecifics
author_idID of the user who wrote the messageCannot be set
chat_idID of the chat the message belongs toCannot be set
contentHTML content of the messageMust not be empty, Type text
created_atTimestamp the message was createdCannot be set
parent_message_idID of the message’s parent messageOptional, cannot be updated, parent message must belong to the same chat, parent message can’t itself have a parent message
reply_countHow many replies the message has, if anyOptional integer (>= 0), cannot be set
message_documentsArray of message documentsOptional, cannot be updated, must be an array of objects with the following attributes: extension, name

The following relationships can be included in requests:

RelationshipTypeDescription
agent_message_feedbackshas_manyFeedback given by the current user on the agent message, returned as an array
authorhas_oneThe user who wrote the message
chathas_oneThe chat the message belongs to
message_documentshas_manyThe documents attached to the message
message_reactionshas_manyThe reactions to the message
thread_bookmarkhas_oneThe bookmark for a message thread

Create

Example request:

{
"data": {
"type": "message",
"attributes": {
"content": "Hello World"
}
}
}

Example response:

{
"data": [
{
"id": "f5139073-dc7d-434e-989e-99786b7535a1",
"type": "message",
"attributes": {
...
}
}
]
}

This endpoint creates a message in a chat. If message_documents are provided, they will be created as well. Created documents will have upload_status set to uploading.

HTTP Request

POST /api/v1/chats/:chat_id/messages

URL Parameters

ParameterDescription
chat_idID of the chat where the message was written

Update

Example request:

{
"data": {
"type": "message",
"attributes": {
"content": "edited chat message"
}
}
}

Example response:

{
"data": {
"id": "67ac4d91-1883-47f8-a9a1-f379bbd29cce",
"type": "message",
"attributes": {
...
}
}
}

This endpoint updates a chat message. Each user can only update their own chat messages.

HTTP Request

PUT /api/v1/chats/:chat_id/messages/:message_id

URL Parameters

ParameterDescription
chat_idID of the chat where the message was written
message_idID of the message to edit

List

Example response:

{
"data": [
{
"id": "0e2eb81a-f952-4e8d-a6f8-9f757459a241",
"type": "message",
"attributes": {
...
}
},
{
...
}
]
}

This endpoint returns messages of a chat.

The sort query parameter is not supported by this endpoint; messages are always sorted by created_at descending, i.e. the latest messages come first.

HTTP Request

GET /api/v1/chats/:chat_id/messages

URL Parameters

ParameterDescription
chat_idThe ID of the chat from which to return messages

Delete

Example response

{
"data": {
"id": "092ff7d2-abad-44e8-af38-d1c427a8b16d",
"type": "message",
"attributes": {
...
}
}
}

This endpoint deletes a chat message, each user can only delete their own chat messages. If the message has associated documents, they will also be deleted.

HTTP Request

DELETE /api/v1/chats/:chat_id/messages/:message_id

URL Parameters

ParameterDescription
chat_idID of the chat where the message was written
message_idID of the message to delete