PLEXICHATNarrative Docs

Messages

Guides, route-group overviews, and live schema entry points for the Plexichat backend.

REST http://api.plexichat.com/api/v1Gateway ws://api.plexichat.com/gatewayVersion a.1.0-49

Messages API

Endpoints for message management.

Base URL: https://api.plexichat.com

GET /channels/{channel_id}/messages

Get messages in a channel with pagination.

Query Parameters

ParameterTypeDefaultConstraintsDescription
limitint501-100Max messages to return
beforestring-Snowflake IDGet messages before this ID
afterstring-Snowflake IDGet messages after this ID

Example Request


curl -X GET "https://api.plexichat.com/channels/123456789012345678/messages?limit=25&before=234567890123456789" \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN"

Response (200 OK)


[
  {
    "id": "123456789012345678",
    "channel_id": "123456789012345678",
    "author_id": "123456789012345678",
    "author_username": "johndoe",
    "author_avatar_url": "https://api.plexichat.com/avatars/users/123456789012345678",
    "content": "Hello, world!",
    "created_at": 1704067200,
    "edited_at": null,
    "reply_to_id": null,
    "attachments": [],
    "embeds": [],
    "pinned": false,
    "reactions": []
  }
]

Error Responses

StatusCodeDescription
403Access deniedNo permission to read messages
404Channel not foundChannel doesn't exist

GET /channels/{channel_id}/messages/search

Search messages in a channel by content.

Headers


Authorization: Bearer <token>

Query Parameters

ParameterTypeRequiredDefaultDescription
contentstringYes-Search query
limitintNo25Max results (1-100)

Example Request


GET /channels/123456789012345678/messages/search?content=hello&limit=10

Response (200 OK)

Returns array of matching messages.

POST /channels/{channel_id}/messages

Send a message to a channel.

Request Body

FieldTypeRequiredConstraintsDescription
contentstringConditionalMax 4000 charsMessage text
reply_to_idstringNoSnowflake IDMessage to reply to
attachmentsarrayNo-File attachments
embedsarrayNo-Rich embeds

At least one of content, attachments, or embeds is required.

Example Request


curl -X POST https://api.plexichat.com/channels/123456789012345678/messages \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Hello, world!",
    "reply_to_id": "123456789012345678"
  }'

Response (200 OK)

Returns the created message object.

Error Responses

StatusCodeDescription
400Empty messageNo content, attachments, or embeds
400Invalid contentContent validation failed
403Permission deniedNo send message permission
404Channel not foundChannel doesn't exist

GET /channels/{channel_id}/messages/{message_id}

Get a specific message.

Headers


Authorization: Bearer <token>

Response (200 OK)

Returns the message object.

Error Responses

StatusCodeDescription
400Invalid message IDID format invalid
403Access deniedNo permission to read
404Message not foundMessage doesn't exist

PATCH /channels/{channel_id}/messages/{message_id}

Edit a message. Only the author can edit their messages.

Request Body

FieldTypeRequiredConstraintsDescription
contentstringYesMax 4000 charsNew message content

Example Request


curl -X PATCH https://api.plexichat.com/channels/123456789012345678/messages/234567890123456789 \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Updated message content"
  }'

Response (200 OK)

Returns the updated message object with edited_at timestamp set.

Error Responses

StatusCodeDescription
400Invalid contentContent validation failed
403Not authorOnly author can edit
404Message not foundMessage doesn't exist

DELETE /channels/{channel_id}/messages/{message_id}

Delete a message. Author or users with manage messages permission can delete.

Example Request


curl -X DELETE https://api.plexichat.com/channels/123456789012345678/messages/234567890123456789 \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN"

Response (200 OK)


{
  "success": true
}

Error Responses

StatusCodeDescription
403Permission deniedNot author and no manage permission
404Message not foundMessage doesn't exist

---

Pinned Messages

GET /channels/{channel_id}/pins

Get all pinned messages in a channel.

Headers


Authorization: Bearer <token>

Response (200 OK)

Returns array of pinned message objects.

PUT /channels/{channel_id}/pins/{message_id}

Pin a message in a channel. Requires manage messages permission.

Headers


Authorization: Bearer <token>

Response (200 OK)


{
  "success": true
}

Error Responses

StatusCodeDescription
403Permission deniedMissing manage messages permission
404Message not foundMessage doesn't exist

DELETE /channels/{channel_id}/pins/{message_id}

Unpin a message from a channel. Requires manage messages permission.

Headers


Authorization: Bearer <token>

Response (200 OK)


{
  "success": true
}

---

Read Receipts

POST /channels/{channel_id}/messages/ack

Mark messages as read in a channel.

Headers


Authorization: Bearer <token>

Query Parameters

ParameterTypeRequiredDescription
message_idstringNoMark as read up to this message ID

If message_id is provided, marks all messages up to and including that message as read.

If not provided, marks all messages in the channel as read.

Response (200 OK)


{
  "success": true,
  "messages_marked": 15
}

GET /channels/{channel_id}/messages/unread

Get unread message count for a channel.

Headers


Authorization: Bearer <token>

Response (200 OK)


{
  "channel_id": "123456789012345678",
  "unread_count": 5
}

GET /users/@me/unread

Get unread message counts for all conversations.

Headers


Authorization: Bearer <token>

Response (200 OK)


{
  "unread_counts": {
    "123456789012345678": 5,
    "234567890123456789": 12
  }
}

---

Typing Indicator

POST /channels/{channel_id}/typing

Trigger typing indicator in a channel.

Broadcasts a typing event to other users in the channel. Works for both server channels and DM conversations.

Headers


Authorization: Bearer <token>

Response (200 OK)


{
  "success": true
}

---

Message Object


{
  "id": "123456789012345678",
  "channel_id": "123456789012345678",
  "author_id": "123456789012345678",
  "author_username": "johndoe",
  "author_avatar_url": "https://cdn.example.com/avatars/123.png",
  "author_badges": ["staff"],
  "content": "Hello, world!",
  "created_at": 1704067200,
  "edited_at": null,
  "reply_to_id": null,
  "attachments": [],
  "embeds": [],
  "pinned": false,
  "status": "read",
  "delivery_count": 15,
  "read_count": 5,
  "read": true,
  "read_by": ["janedoe", "bobsmith"],
  "reactions": []
}
FieldTypeDescription
idstringMessage's snowflake ID
channel_idstringChannel ID
author_idstringAuthor's user ID
author_usernamestringAuthor's username
author_avatar_urlstring?Author's avatar URL
author_badgesarrayAuthor's profile badges
contentstring?Message text content
created_atintUnix timestamp of creation
edited_atint?Unix timestamp of last edit
reply_to_idstring?ID of message being replied to
attachmentsarrayFile attachments
embedsarrayRich embeds
pinnedboolWhether message is pinned
statusstring?User status: "sent", "delivered", or "read"
delivery_countintNumber of users who received the message
read_countintNumber of users who read the message
readboolWhether current user has read it
read_byarrayList of usernames who read it (sender only)
reactionsarrayReaction data

Attachment Object


{
  "id": "123456789012345678",
  "filename": "image.png",
  "content_type": "image/png",
  "size": 12345,
  "url": "https://cdn.example.com/attachments/image.png",
  "hash": "abc123..."
}
FieldTypeDescription
idstringAttachment's snowflake ID
filenamestringOriginal file name
content_typestringMIME type
sizeintFile size in bytes
urlstringCDN URL to download
hashstring?File checksum

---

Related Endpoints