Message Model
A message.
Properties
Property | Type | Description |
---|---|---|
attachments | array<MessageAttachment> | Array of Message Attachment objects |
autoForwardedFrom | User | User the message is auto forwarded from |
body | string | Texts of the message |
canRecall | boolean | Indicates whether the message can be recalled |
conversation | Conversation | Conversation the message is in |
conversationId | string | The conversation ID the message belongs to |
counterParty | User |Group | Either the recipient or the group , depending on the conversation type |
counterPartyId | string | ID of counterParty |
counterPartyType | string | Values: user , group , distributionList |
createdAt | Date | Time and date message was created |
currentSenderRole | Role | Role of the sender of the message, if the message was sent by a role |
deleteOnRead | boolean | Indicates if the message gets deleted once the recipient reads it |
distributionList | DistributionList | Distribution list object, if the message is part of one |
escalationExecution | EscalationExecution | Escalation execution object, if the message has an escalation |
escalationExecutionChange | EscalationExecutionChange | Escalation execution change object showing change of escalation |
escalationExecutionId | string | ID of escalationExecution |
expiresAt | int | A unix timestamp for date when the message expires |
group | Group | Group associated with message if message is sent to a group |
groupMembersChange | GroupMembersChange | Group members change object showing change of members if message in group |
id | string | ID of message |
isAutoForwarded | boolean | Indicates whether the message will be auto forwarded |
isOutgoing | boolean | Indicates whether the message is outgoing or incoming |
inTimeline | boolean | Indicates whether the message is visible |
isUnread | boolean | Indicates whether the message is unread or read |
messageType | string | Values: HIGHER_CONTINUATION , LOWER_CONTINUATION , USER_SENT |
metadata | Array< Message Metadata> | Array of metadata objects on a message |
priority | string | Message priority. Values: NORMAL (default), HIGH |
recipient | User |Group | Either the recipient or the group , depending on the conversation type |
recipientOrganization | Organization | Organization of the recipient for this message |
sender | User | User that sent message |
senderId | string | ID of sender |
senderOrganization | Organization | Organization of the sender for this message |
senderOrganizationId | string | ID of senderOrganization |
senderStatus | string | Message status, one of these values: SENDING , SENT , FAILED , RETRYING , NEW , NA |
serverId | string | Canonical ID of this message from server; generally the same as id unless the message was sent in the current session |
shouldEnsureRecipientStatus | boolean | Determines if recipient status needs to be ensured |
sortNumber | int | sort number of message to determine message order |
sortSeries | int | sort number of message to determine message order |
statusesPerRecipient | Array< MessageStatusPer...> | Array of all recipients and their read/delivery status of this message |
subType | string | One of EMPTY_ROLE_NOTIFICATION , NA (default), or ROLE_AWAY_NOTIFICATION |
ttl | int | The number of minutes until the message should be deleted. -1 = never. (default: -1 ) |
Types of messages
messageType
indicates the type of the message. Possible types:
USER_SENT
This message was sent by a user and may contain body
, attachments
, or metadata
to be rendered.
ESCALATION_EXECUTION_CHANGE
This message is a log message of a change to an escalation execution, and is available in both the original role P2P conversation and the group conversation about the escalation if one exists. It shows when an escalation execution changes state in a way that needs to show up on the conversation.
This type of message generates a body
text such as Escalation 14CAB6 Cancelled by John Doe
.
In order to construct this message manually, use the extra escalationExecutionChange
attribute:
message.sender: User
- indicates the current data of the user who did the action, ornull
in the case ofNO_RESPONSE
message.escalationExecutionChange.action: string
- values:ACKNOWLEDGED
,CANCELLED
,INITIATED
, orNO_RESPONSE
message.escalationExecutionChange.actionTime: Date
- time that the action occurredmessage.escalationExecutionChange.actor: Object
- indicates the historicaldisplayName
andid
of the user who did the action, ornull
in the case ofNO_RESPONSE
GROUP_MEMBERSHIP_CHANGE
This message is a log message of a group members change, and only available in group conversations. It shows when a group member adds or removes another member, or when someone joins/leaves the group (join event is available only in groups with groupType='FORUM'
), or when someone is opted into or opted out of a role.
This type of message generates a body
text such as John Doe added Alice to this group
or Bob left this group
.
In order to construct this message manually, use the extra groupMembersChange
attribute:
message.sender: User
- indicates the current data of the user who added or removed members in the group, or joined/left the group, or the role affectedmessage.groupMembersChange.action: string
- values:ADD
,REMOVE
,JOIN
,LEAVE
,OPT_IN
, orOPT_OUT
message.groupMembersChange.actionTime: Date
- time that the action occurredmessage.groupMembersChange.actor: Object
- indicates the historicaldisplayName
andid
of the user who added or removed members in the group, or joined/left the group, or the role affectedmessage.groupMembersChange.memberIds: string[]
- an array of the affected member IDsmessage.groupMembersChange.members: Object[]
- an array of the affected members containing historicaldisplayName
andid
CALL_CHANGE
This message type is used for log messages that document a change in the state of a call. This is currently used with Voice/Video calls to track when a call has ended
This type of message generates a body
text such as Outgoing Video Call 2:11 PM (5mins)
.
Message Attachment
Properties
Message attachments will contain these properties. If some properties are missing, it may be necessary to run client.messages.findAttachment() to fill them in.
When a message has been sent within the current session, this may be a File object.
Property | Type | Description |
---|---|---|
id | string | Unique identifier for this attachment within the message |
isLocal | boolean | Whether the attachment was sent in this session and is still a File object |
name | ?string | The name of this attachment; if not downloaded yet, this will be undefined |
Message Metadata
All the sendTo*
methods can append some metadata on a message. Message metadata is an array of MessageMetadata
objects, which can be sent with the following structure.
{namespace: 'company-name:some-unique-namespace',payload: { /* a plain object */ },}
Properties
When the metadata payload is retrieved from the server, it will contain these properties:
Property | Type | Description |
---|---|---|
mimetype | string | Usually application/json |
namespace | string | A unique namespace which identifies the metadata object |
payload | string |Object | If the payload was valid JSON, this will be the parsed JSON object, otherwise a string |