Messages
Monday, November 23, 2020 2:06 AMA message is a piece of text, an image or a location that a user can send to a conversation.
Message data
Field | Type | Description |
---|---|---|
id | string | Read-only. A unique ID for the message, generated by TalkJS. Example: |
conversationId | string | ID of the Conversation this message was sent to. |
type | "UserMessage" |
Always set to "UserMessage" for regular messages. Read about system messages for the alternative. |
senderId | string | The user ID of the sender. |
readBy | array of string | Read-only. List of the user IDs who have already read and received this message. Does not include the sender. Example: |
text | string | The text of the message. Only given if this message is a text message. |
attachment | { url: string, size: number } |
Read-only. Only given if this message is a file transfer. An object with the location and filesize (in bytes) of the given file. Read how to send a file using the REST API |
location | array of number | An array of two numbers which represent the longitude and latitude of this location, respectively. Only given if this message is a shared location. Example: |
origin | "web" | "rest" | "email" | "import" |
Determines how this message was sent: respectively, Via a web browser (or mobile Webview), via the REST API, via reply-to-email, or using the import API. |
createdAt | number | Timestamp when this message was sent, expressed as the amount of milliseconds since the UNIX epoch (1970-1-1, 00:00:00 UTC). Example: |