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
contentContent of the messageMust not be empty, Type text
created_atTimestamp the message was createdCannot be set

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.

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.

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