Message

The message object is the very soul of a conversation. It encapsulates all the information needed in order to represent a single entry on a message list.

Messages are stored in the rocketchat_message collection on MongoDB.

The IMessage interface represents the structure of a message object in the Rocket.Chat It defines the properties and their types that can be associated with a message sent. You can check the IMessage interface here.

Message Object

Example Object
{
  "_id": "8gMsLe9ApZjo2D2iB",
  "rid": "EhpNtqqrMXT4QWk3z",
  "msg": "This meesage is from Rocket.Chat.",
  "ts": {
    "$date": "2023-02-09T13:35:59.484Z"
  },
  "u": {
    "_id": "rYhzFRd2QZjNwAAXX",
    "username": "rodriq",
    "name": "Rodriq"
  },
  "_updatedAt": {
    "$date": "2023-02-09T13:40:47.334Z"
  },
  "urls": [],
  "mentions": [],
  "channels": [],
  "md": [
    {
      "type": "PARAGRAPH",
      "value": [
        {
          "type": "PLAIN_TEXT",
          "value": "This meesage is from "
        },
        {
          "type": "LINK",
          "value": {
            "src": {
              "type": "PLAIN_TEXT",
              "value": "//Rocket.Chat."
            },
            "label": {
              "type": "PLAIN_TEXT",
              "value": "Rocket.Chat."
            }
          }
        }
      ]
    }
  ],
  "editedAt": {
    "$date": "2023-02-09T13:40:47.303Z"
  },
  "editedBy": {
    "_id": "rYhzFRd2QZjNwAAXX",
    "username": "rodriq"
  }
}

Fields

The message object contains these fields.

  • The user presented on u and editedBy fields are a simplified version of the user information: (_id: The user id, username: The username, name: The name)

  • The URL metadata contains several informational fields: (url: The URL itself (just as it appears on the message), meta: URL metadata (varies accord to the URL), headers: Some HTTP headers (varies accord to the URL), parsedUrl: The parsed URL broken into its parts)

Message Type

Some of the message types are listed below. A full list of the message-type property can be found here

Attachment Object

The attachment object is fully described here

{
    "messages": [
        {
            "_id": "message-id",
            "rid": "room-id",
            "msg": "Hello World!",
            "ts": { "$date": 1480377601 },
            "u": {
                "_id": "user-id",
                "username": "username"
            },
            "_updatedAt": { "$date": 1480377601 }
        },
        {
            "_id": "message-id",
            "rid": "room-id",
            "msg": "Hello!",
            "ts": { "$date": 1480377601 },
            "u": {
                "_id": "user-id",
                "username": "username"
            },
            "_updatedAt": { "$date":1480377601 },
            "editedAt": { "$date": 1480377601 },
            "editedBy": {
                "_id": "user-id",
                "username": "username"
            }
        }
    ]
}

Last updated

Rocket.Chat versions receive support for six months after release.