Message
An object representing a TalkJS message.
1{2 "id": "msg_5fCIVedfUSBN2gx1jlyf9P",3 "conversation": {4 "id": "alice_self",5 "custom": {},6 "subject": null,7 "welcomeMessages": null,8 "photoUrl": null,9 "participants": {10 "650d5ed0cae49": {11 "access": "ReadWrite"12 }13 }14 },15 "isByMe": true,16 "senderId": "650d5ed0cae49",17 "sender": {18 "id": "650d5ed0cae49",19 "name": "Alice",20 "welcomeMessage": null,21 "photoUrl": null,22 "role": "default",23 "custom": {},24 "availabilityText": null,25 "locale": null,26 },27 "body": "Hey",28 "type": "text",29 "timestamp": 1709134981992,30 "read": true,31 "origin": "web",32 "custom": {},33 "attachment": null,34 "location": null35}
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 | UserData | 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 | string | Determines how this message was sent: through a web browser (or mobile WebView), with the REST API, by reply-to-email, or using the import API |
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 | {url: string; size: number} | 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. |