thread-message-added


Event: #

This event is fired when a new message is added to a thread, whether via the UI or API or anywhere else.

Payload #


message #

WebhookMessage

This is an object with the following fields:


author #

ClientUserData

This is an object with the following fields:


id
string
The user's ID. This is unique within an application.

name
string | null
The user's name.

shortName
string | null
The user's short name. In most cases, Cord components will prefer using this name over name when set.

displayName
string
The primary display name of the user. This is a readonly field that's provided as a convenience. Its value is the user's shortName or name, preferring shortName if both are set, or the string "unknown" if neither is set.

secondaryDisplayName
string
The secondary display name of the user, in cases where you might want to display a secondary name (such as in a subtitle). This is a readonly field that's provided as a convenience. Its value is the user's name or shortName, preferring name if both are set, or the string "Unknown" if neither is set.

profilePictureURL
string | null
A URL to the user's profile picture.

metadata
EntityMetadata
Any metadata that has been set for the user.

type #

"action_message" | "user_message"
The type of message this is. A user_message is a message that the author sent. An action_message is a message about something that happened, such as the thread being resolved. The default value is user_message.

id #

string
The ID for the message. If a message is created with no ID, a random UUID-based ID will be automatically created for it.

iconURL #

string | null
The URL of the icon to show next to the message. This is only used for action_message messages; other messages show the avatar of the author. If an action_message does not have an icon set, no icon is shown.

createdTimestamp #

Date
The timestamp when this message was created. The default value is the current time.

metadata #

EntityMetadata
Arbitrary key-value pairs that can be used to store additional information.

url #

string | null
A URL where the message can be seen. This determines where a user is sent when they click on a reference to this message, such as in a notification. If unset, it defaults to the thread's URL.

content #

object[]
The content of the message.

groupID #

string
The ID for the group this message belongs to.

threadID #

string
The ID for the thread this message is part of.

plaintext #

string
A plaintext version of the structured message content.

reactions #

Reaction[]
The reactions to this message.

This is an array of objects, each of which has the following fields:


reaction
string
The emoji reaction.

userID
string
The ID of the user who reacted to the message.

timestamp
Date
The timestamp of when the reaction was created.

attachments #

array
The items attached to this message.

seenBy #

string[]
A list of IDs of the users that have seen the message.

deletedTimestamp #

Date | null
The timestamp when this message was deleted, if it was. If unset, the message is not deleted.

updatedTimestamp #

Date | null
The timestamp when this message was last edited, if it ever was. If unset, the message does not show as edited.

translationKey #

string | null
An optional translation key used for this message. This is useful for system-generated messages where you might want to translate or customize them at runtime. See the translations documentation for more information.

extraClassnames #

string | null
A optional space separated list of classnames to add to the message.

skipLinkPreviews #

boolean
If set, Cord won't analyze links in the message to generate previews.

thread #

CoreThreadData

This is an object with the following fields:


id #

string
The ID for this thread.

groupID #

string
The group ID this thread is in.

total #

number
The total number of messages in this thread. Equal to user messages + action messages. Deleted messages are excluded from this count.

userMessages #

number
The number of messages in this thread that were sent by users (i.e., not action messages).

actionMessages #

number
The number of action messages sent in this thread. An example is the message that appears when a thread is resolved.

deletedMessages #

number
The number of deleted messages in this thread.

resolved #

boolean
Whether this thread is resolved. This is equivalent to checking if resolvedTimestamp is null.

resolvedTimestamp #

Date | null
The timestamp when this thread was resolved. Set to null if this thread is not resolved.

participants #

ThreadParticipant[]
All of the users who are engaging in this thread. This includes both subscribed and unsubscribed users.

This is an array of objects, each of which has the following fields:


lastSeenTimestamp
Date | null
The timestamp of the most recent message or reaction that this user has seen in this thread. Is null if this participant has never viewed this thread.

userID
string | null
The user ID of the participant. Can be null if the current viewer no longer shares a group with this participant (and therefore can no longer access that participant's information).

subscribers #

string[]
All of the users who are subscribed to this thread.

repliers #

string[]
All of the users who have replied to this thread.

actionMessageRepliers #

string[]
Authors of any message of type action_message in this thread's replies, including automatically generated messages from resolving or unresolving the thread.

typing #

string[]
The users that are currently typing in this thread. Typing status is transient in nature, so the value is the set of users typing at a particular instant, but may change rapidly.

name #

string
The name of the thread. This is shown to users when the thread is referenced, such as in notifications. This should generally be something like the page title.

url #

string
A URL where the thread can be seen. This determines where a user is sent when they click on a reference to this thread, such as in a notification, or if they click on a reference to a message in the thread and the message doesn't have its own URL.

location #

Location
The location of this thread.

metadata #

EntityMetadata
Arbitrary key-value pairs that can be used to store additional information.

extraClassnames #

string | null
An optional space separated list of classnames to add to the thread.

usersToNotify #

UsersToNotify[]

This is an array of objects, each of which has the following fields:


replyActions #

"mention" | "create-thread" | "assign-task" | "unassign-task" | "attach-file"[] | null

id #

string
The user's ID. This is unique within an application.

name #

string | null
The user's name.

shortName #

string | null
The user's short name. In most cases, Cord components will prefer using this name over name when set.

displayName #

string
The primary display name of the user. This is a readonly field that's provided as a convenience. Its value is the user's shortName or name, preferring shortName if both are set, or the string "unknown" if neither is set.

secondaryDisplayName #

string
The secondary display name of the user, in cases where you might want to display a secondary name (such as in a subtitle). This is a readonly field that's provided as a convenience. Its value is the user's name or shortName, preferring name if both are set, or the string "Unknown" if neither is set.

profilePictureURL #

string | null
A URL to the user's profile picture.

metadata #

EntityMetadata
Any metadata that has been set for the user.

Ask Cordy