Message Model

A message.

Properties

PropertyTypeDescription
attachmentsarray<MessageAttachment>Array of Message Attachment objects
autoForwardedFromUserUser the message is auto forwarded from
bodystringTexts of the message
canRecallbooleanIndicates whether the message can be recalled
conversationConversationConversation the message is in
conversationIdstringThe conversation ID the message belongs to
counterPartyUser|GroupEither the recipient or the group, depending on the conversation type
counterPartyIdstringID of counterParty
counterPartyTypestringValues: user, group, distributionList
createdAtDateTime and date message was created
currentSenderRoleRoleRole of the sender of the message, if the message was sent by a role
deleteOnReadbooleanIndicates if the message gets deleted once the recipient reads it
distributionListDistributionListDistribution list object, if the message is part of one
escalationExecutionEscalationExecutionEscalation execution object, if the message has an escalation
escalationExecutionChangeEscalationExecutionChangeEscalation execution change object showing change of escalation
escalationExecutionIdstringID of escalationExecution
expiresAtintA unix timestamp for date when the message expires
groupGroupGroup associated with message if message is sent to a group
groupMembersChangeGroupMembersChangeGroup members change object showing change of members if message in group
idstringID of message
isAutoForwardedbooleanIndicates whether the message will be auto forwarded
isOutgoingbooleanIndicates whether the message is outgoing or incoming
inTimelinebooleanIndicates whether the message is visible
isUnreadbooleanIndicates whether the message is unread or read
messageTypestringValues: HIGHER_CONTINUATION, LOWER_CONTINUATION, USER_SENT
metadataArray<Message Metadata>Array of metadata objects on a message
prioritystringMessage priority. Values: NORMAL (default), HIGH
recipientUser|GroupEither the recipient or the group, depending on the conversation type
recipientOrganizationOrganizationOrganization of the recipient for this message
senderUserUser that sent message
senderIdstringID of sender
senderOrganizationOrganizationOrganization of the sender for this message
senderOrganizationIdstringID of senderOrganization
senderStatusstringMessage status, one of these values: SENDING, SENT, FAILED, RETRYING, NEW, NA
serverIdstringCanonical ID of this message from server; generally the same as id unless the message was sent in the current session
shouldEnsureRecipientStatusbooleanDetermines if recipient status needs to be ensured
sortNumberintsort number of message to determine message order
sortSeriesintsort number of message to determine message order
statusesPerRecipientArray<MessageStatusPer...>Array of all recipients and their read/delivery status of this message
subTypestringOne of EMPTY_ROLE_NOTIFICATION, NA (default), or ROLE_AWAY_NOTIFICATION
ttlintThe 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, or null in the case of NO_RESPONSE
  • message.escalationExecutionChange.action: string - values: ACKNOWLEDGED, CANCELLED, INITIATED, or NO_RESPONSE
  • message.escalationExecutionChange.actionTime: Date - time that the action occurred
  • message.escalationExecutionChange.actor: Object - indicates the historical displayName and id of the user who did the action, or null in the case of NO_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 affected
  • message.groupMembersChange.action: string - values: ADD, REMOVE, JOIN, LEAVE, OPT_IN, or OPT_OUT
  • message.groupMembersChange.actionTime: Date - time that the action occurred
  • message.groupMembersChange.actor: Object - indicates the historical displayName and id of the user who added or removed members in the group, or joined/left the group, or the role affected
  • message.groupMembersChange.memberIds: string[] - an array of the affected member IDs
  • message.groupMembersChange.members: Object[] - an array of the affected members containing historical displayName and id

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.

PropertyTypeDescription
idstringUnique identifier for this attachment within the message
isLocalbooleanWhether the attachment was sent in this session and is still a File object
name?stringThe 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:

PropertyTypeDescription
mimetypestringUsually application/json
namespacestringA unique namespace which identifies the metadata object
payloadstring|ObjectIf the payload was valid JSON, this will be the parsed JSON object, otherwise a string