Messages
Messages are the core communication unit in Local Universe channels. They support text content, replies, and various message types for system events.
The message model
Properties
- Name
id- Type
- string
- Description
Unique identifier for the message.
- Name
type- Type
- integer
- Description
The message type.
- Name
content- Type
- string
- Description
The text content of the message.
- Name
channel_id- Type
- string
- Description
The ID of the channel this message was sent in.
- Name
author- Type
- User
- Description
The user who sent this message.
- Name
message_reference- Type
- Message?
- Description
The referenced message, if this is a reply.
- Name
flags- Type
- integer
- Description
Message flags bitfield.
- Name
created_at- Type
- string
- Description
ISO timestamp of when the message was created.
- Name
edited_at- Type
- string?
- Description
ISO timestamp of when the message was last edited, if any.
Message types
| Value | Name | Description |
|---|---|---|
| 0 | DEFAULT | A normal user message |
| 1 | RECIPIENT_ADD | A recipient was added to a group DM |
| 2 | RECIPIENT_REMOVE | A recipient was removed from a group DM |
| 3 | CALL | A call was started |
| 4 | CHANNEL_NAME_CHANGE | The channel name was changed |
| 5 | CHANNEL_ICON_CHANGE | The channel icon was changed |
| 6 | CHANNEL_PINNED_MESSAGE | A message was pinned |
| 7 | USER_JOIN | A user joined the system |
| 19 | REPLY | A reply to another message |
| 20 | CHAT_INPUT_COMMAND | A slash command was used |
| 21 | THREAD_STARTER_MESSAGE | The first message in a thread |
List messages
Retrieve messages from a channel. Sorted by creation time descending (newest first).
Query parameters
- Name
limit- Type
- integer
- Description
Maximum number of messages to return (1-100). Default: 50.
- Name
before- Type
- string
- Description
Get messages before this message ID.
- Name
after- Type
- string
- Description
Get messages after this message ID.
Request
curl "https://api.localuniverse.io/v1/channels/1344387816333352652/messages?limit=10" \
-H "Authorization: Bearer {token}"
Response
[
{
"id": "1344389816333352001",
"type": 0,
"content": "Hello, world!",
"channel_id": "1344387816333352652",
"author": {
"id": "1344387816333399999",
"username": "tino",
"avatar": "https://cdn.localuniverse.io/avatars/1344387816333399999/avatar.png",
"verified": true,
"public_flags": 0
},
"flags": 0,
"created_at": "2025-02-26T19:25:12.848375Z",
"edited_at": null
}
]
Create a message
Required attributes
- Name
content- Type
- string
- Description
The message content.
Optional attributes
- Name
nonce- Type
- string
- Description
Client-generated nonce for optimistic message deduplication.
- Name
message_reference- Type
- object
- Description
Reference to another message for replies.
- Name
message_id- Type
- string
- Description
The ID of the message being replied to.
Request
curl -X POST https://api.localuniverse.io/v1/channels/1344387816333352652/messages \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"content": "Hello, world!", "nonce": "abc123"}'
Response
{
"id": "1344390816333352002",
"type": 0,
"content": "Hello, world!",
"channel_id": "1344387816333352652",
"author": {
"id": "1344387816333399999",
"username": "tino",
"avatar": "https://cdn.localuniverse.io/avatars/1344387816333399999/avatar.png",
"verified": true,
"public_flags": 0
},
"flags": 0,
"created_at": "2025-02-26T19:30:45.123456Z",
"edited_at": null
}
Delete a message
Delete a message. You can delete your own messages, or any message if you have MANAGE_MESSAGES permission in the channel.
Request
curl -X DELETE https://api.localuniverse.io/v1/channels/1344387816333352652/messages/1344390816333352002 \
-H "Authorization: Bearer {token}"
