Event: #
This event is fired when a new notification is created, whether via the UI or API or anywhere else.
Payload #
The
ID for this notification.
The
IDs of the user(s) who sent this notification. The Cord backend will sometimes aggregate multiple notifications together, causing them to have multiple senders. For example, if multiple people react to the same message, that will generate only one notification (but with multiple senders, one for each person who reacted).
The URL of an icon image for this notification, if one was specified when it was created. This will always be null
for Cord's internally-generated notifications (i.e., it can only be non-null for notifications you create via the REST API).
The "header" or "text" of the notification. This will represent text like "Alice replied to your thread." or similar. For notifications you create via the REST API, this will be based upon the template
parameter, see below.
This is an array of items. Each item can be one of the following:
This is an object with the following fields:
Indicator that this is a string header node.
The text to display. This text may start and/or end with whitespace, which should typically not be trimmed. For example, in order to display the notification "Alice replied to your thread."
, this would typically be composed of two nodes -- a user node for Alice, and then a text node containing " replied to your thread."
, with a meaningful space at the front, to separate this node from Alice's name.
Whether the text should be formatted in bold.
This is an object with the following fields:
Indicator that this is a user reference header node.
The indicated user.
This is an object with the following fields:
The user's ID. This is unique within an application.
The user's short name. In most cases, Cord components will prefer using this name over name
when set.
profilePictureURL
string | null
A URL to the user's profile picture.
Any metadata that has been set for the user.
Additional context attached to the notification. For example, if this notification is about a new reaction on a message, the attachment will specify what message received that new reaction.
A renderer will typically check the type
field of the attachment and render that attachment type below the header
.
This property can be one of the following:
NotificationURLAttachment
This is an object with the following fields:
Indicator that this is a URL attachment.
The URL this attachment points to. This would typically be the URL to send the browser to if this notification is clicked.
NotificationMessageAttachment
This is an object with the following fields:
Indicator that this is a message attachment.
message #
CoreMessageData
The relevant message.
This is an object with the following fields:
The ID for the message. If a message is created with no ID, a random UUID-based ID will be automatically created for it.
The ID for the user that sent the message.
The ID for the organization this message belongs to.
The ID for the thread this message is part of.
The content of the message.
A plaintext version of the structured message content.
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.
The timestamp when this message was created. The default value is the current time.
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.
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.
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
.
Arbitrary key-value pairs that can be used to store additional information.
A optional space separated list of classnames to add to the message.
The items attached to this message.
The reactions to this message.
A list of IDs of the users that have seen the message.
readStatus #
"unread" | "read"
Whether this notification has been read by the recipient yet.
The time this notification was sent.
An arbitrary JSON object specified when the notification was created. This will always be an empty object for Cord's internally-generated notifications (i.e., it can only be non-null for notifications you create via the REST API).