Admin API / Types
ChatMessage
ObjectA message in a chat channel, in a livestream chat or in a direct conversation. A channel message is visible when the channel is in the caller's visible set and passes the read rule, the message is within the channel's retention, and the caller wrote it or holds chat moderation rights: the MODERATOR role or higher, or an ACTIVE membership with can_moderate_chat. A livestream message is visible when the livestream is visible to the caller, by the rule of node, the message is a USER or SOCIAL message within retention, and the caller wrote it, holds chat moderation rights, or holds the show moderation grant: host or staff of the host's store, joined cohost, assigned show moderator, or the MODERATOR role or higher. A direct message is visible when the client holds admin:chat:read, the conversation is in directConversation, and the message is after the caller's hide point and within retention. A deleted message reads as a tombstone: text null, mentionedUsers empty and replyTo null.
admin:chat:read admin:moderation:readThe requirement applies to every field of ChatMessage unless that field declares its own scopes.
type ChatMessage implements NodeFields
| Field | Type | Description |
|---|---|---|
attachments | [ChatMessageAttachment!]! | Listings, orders, livestreams, members, images and link previews, in the order they were attached. Empty when the message is deleted. Leaves out an attachment that the caller cannot see: a listing, order, livestream or member outside its visible set, or one whose type needs a client scope that the client does not hold. |
author | User | The author. Null when the author's account is not visible in the store. |
createdAt | DateTime! | When the message was posted. |
deletedAt | DateTime | When the author or a moderator deleted the message. Null while the message is live. |
editedAt | DateTime | When the author last edited the message. Null when never edited. |
id | ID! | A globally unique ID. Treat this value as an opaque string. It holds the channel and the message sequence number. |
isSuspicious | Boolean! | True for another user's direct message whose text has a spam phrase. False for deleted messages, channel and livestream messages, and the caller's messages. |
location | ChatMessageLocation! | Where the message was posted. The ChatChannel and DirectConversation fields need admin:chat:read, and the Livestream fields need admin:livestreams:read. |
mentionedUsers | [User!]! | Users mentioned in text, in token order. Empty when deleted. Leaves out users the caller cannot see. |
mentionsEveryone | Boolean! | True when the message mentions the whole channel. |
replyTo | ChatMessage | The message this one replies to. A deleted target has text null. Null when there is none, when the target is outside the channel's retention window, or when the caller cannot see it. |
text | String | Sanitised HTML as stored, as marketplace-api returns it. The allowed tags are b, i, strong, em, a, p, span, table, tr, td, th, ul, li and ol. A mention is <span class="mention">@{userId}</span> and resolves through mentionedUsers. Null when deleted. |
type | ChatMessageType! | The kind of message. Channel messages are USER messages. Livestream messages are USER or SOCIAL messages. |
viewer | ChatMessageViewerState! | The caller's relation to the message. The operations use the same checks. |