Message
The message object is the very soul of a conversation. It encapsulates all the information need in order to represent a single entry on a message list.
The message object contains these fields:
  • _id: The message id
  • rid: The room id - Identify the room the message belongs
  • msg: The textual message
  • ts: The message time stamp (date of creation on client)
  • u: The user that sent the message
  • _updatedAt: The time stamp when the message got saved on the server
  • editedAt: (Optional) The time stamp of when the message was edited
  • editedBy: (Optional) The user that edited the message
  • urls: (Optional) A collection of URLs metadata. Available when the message contains at least one URL
  • attachments: (Optional) A collection of attachment objects, available only when the message has at least one attachment
  • alias: (Optional) A way to display the message is "sent" from someone else other than the user who sent the message
  • avatar: (Optional) A url to an image, that is accessible to anyone, to display as the avatar instead of the message user's account avatar
  • groupable: (Optional) Boolean that states whether or not this message should be grouped together with other messages from the same user
  • parseUrls: (Optional) Whether Rocket.Chat should try and parse the urls or not
The user presented on u and editedBy fields are a simplified version of the user information:
  • _id: The user id
  • username: The username
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
1
{
2
"messages": [
3
{
4
"_id": "message-id",
5
"rid": "room-id",
6
"msg": "Hello World!",
7
"ts": { "$date": 1480377601 },
8
"u": {
9
"_id": "user-id",
10
"username": "username"
11
},
12
"_updatedAt": { "$date": 1480377601 }
13
},
14
{
15
"_id": "message-id",
16
"rid": "room-id",
17
"msg": "Hello!",
18
"ts": { "$date": 1480377601 },
19
"u": {
20
"_id": "user-id",
21
"username": "username"
22
},
23
"_updatedAt": { "$date":1480377601 },
24
"editedAt": { "$date": 1480377601 },
25
"editedBy": {
26
"_id": "user-id",
27
"username": "username"
28
}
29
}
30
]
31
}
Copied!
Last modified 8mo ago
Export as PDF
Copy link
Edit on GitHub