For AI agents: Find a documentation index at https://talkjs.com/llms.txt (full content at https://talkjs.com/llms-full.txt). Get a markdown version of any page by appending .md to its URL path.
Message
Represent messages and their content, sender, and conversation data.
An object representing a TalkJS message.
{
"id": "msg_5fCIVedfUSBN2gx1jlyf9P",
"conversation": {
"id": "alice_self",
"custom": {},
"subject": null,
"welcomeMessages": null,
"photoUrl": null,
"participants": {
"650d5ed0cae49": {
"access": "ReadWrite"
}
}
},
"isByMe": true,
"senderId": "650d5ed0cae49",
"sender": {
"id": "650d5ed0cae49",
"name": "Alice",
"welcomeMessage": null,
"photoUrl": null,
"role": "default",
"custom": {},
"availabilityText": null,
"locale": null,
},
"body": "Hey",
"type": "text",
"timestamp": 1709134981992,
"read": true,
"origin": "web",
"custom": {},
"attachment": null,
"location": null
}| Name | Type | Description |
|---|---|---|
| id | string | The message's ID |
| conversation | ConversationData | Contains the conversation data that the message belongs to |
| isByMe | boolean | true if the message was sent by the current user |
| senderId | string | null | The senderID (userID) for the person that sent the message |
| sender | UserSnapshot | null | The user that sent the message |
| body | string | Contains the message's content |
| type | "media" | "text" | "location" | Specified if the message is media (file), text or a shared location |
| timestamp | number | UNIX timestamp specifying when the message was sent (UTC, in milliseconds) |
| read | boolean | true if the message has been read, false when it hasn't been read yet |
| origin | "web" | "rest" | "import" | "email" | Determines how this message was sent: via a mobile SDK / Classic SDK ("web"), via UI components / Data API / REST API ("rest"), imported via the REST API ("import"), or sent as a reply to an email notification ("email") |
| custom | CustomData | Allows you to set custom metadata for the Message. Set any property to null to delete the existing value, if any. When omitted or undefined, the existing value remains unchanged. |
| attachment | Attachment | null | Only given if the message's type equals "media". An object with the URL and filesize (in bytes) of the given file. |
| location | [number, number] | null | Only given if the message's type equals "location". An array of two numbers which represent the longitude and latitude of this location, respectively. Only given if this message is a shared location. |