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

ValueNameDescription
0DEFAULTA normal user message
1RECIPIENT_ADDA recipient was added to a group DM
2RECIPIENT_REMOVEA recipient was removed from a group DM
3CALLA call was started
4CHANNEL_NAME_CHANGEThe channel name was changed
5CHANNEL_ICON_CHANGEThe channel icon was changed
6CHANNEL_PINNED_MESSAGEA message was pinned
7USER_JOINA user joined the system
19REPLYA reply to another message
20CHAT_INPUT_COMMANDA slash command was used
21THREAD_STARTER_MESSAGEThe first message in a thread

GET/v1/channels/:channelId/messages

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

GET
/v1/channels/1344387816333352652/messages?limit=10
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
  }
]

POST/v1/channels/:channelId/messages

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

POST
/v1/channels/1344387816333352652/messages
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/v1/channels/:channelId/messages/:messageId

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

DELETE
/v1/channels/1344387816333352652/messages/1344390816333352002
curl -X DELETE https://api.localuniverse.io/v1/channels/1344387816333352652/messages/1344390816333352002 \
  -H "Authorization: Bearer {token}"

Was this page helpful?