comments module lets you create, fetch, update, and delete comments, and manage reactions on them. All actions are performed on behalf of the logged-in user.
createComment
Creates a comment on an entity. Optionally a reply, with a GIF, mentions, attachments, or metadata.string
required
The Sublay entity ID the comment belongs to.
string
Your application’s identifier for this comment.
string
The comment’s text content.
GifData | null
An optional GIF attached to the comment.
Mention[]
User mentions embedded in the comment.
string | null
The ID of the parent comment when this is a reply.
string
The ID of another comment this comment references.
Record<string, any>[]
File or media attachments.
Record<string, any>
Arbitrary public metadata.
Promise<Comment>
fetchComment
Fetches a single comment by its ID.string
required
The Sublay comment ID.
string
Comma-separated list of associations to populate.
Promise<Comment>
fetchCommentByForeignId
Fetches a comment by your application’s own identifier.string
required
Your application’s comment identifier.
string
Comma-separated list of associations to populate.
Promise<Comment>
updateComment
Updates a comment’s content.string
required
The Sublay comment ID to update.
string
required
The new content for the comment.
Promise<Comment>
deleteComment
Deletes a comment.string
required
The Sublay comment ID to delete.
Promise<void>
fetchManyComments
Fetches a paginated list of comments, filterable by entity, user, or parent.string
Filter to comments on a specific entity.
string
Filter to comments authored by a given user.
string
Filter to replies of a specific parent comment.
number
Page number (1-indexed).
number
Results per page.
string
Sort order:
"createdAt" (newest first; honors sortDir), "top", or "controversial". "new" and "old" are deprecated aliases for "createdAt" (removed in v8) — the server still accepts them but responds with a deprecation header.string
Comma-separated list of associations to populate.
string
Filter by source ID.
"exclude" | "include-outbound-blocked"
How to treat comments authored by users the viewer is block-edged with.
"exclude" (default) hides them; "include-outbound-blocked" re-includes only the viewer’s own outbound-blocked authors — never content from users who blocked the viewer. No effect without the moderation bundle.Promise<PaginatedResponse<Comment>>
addReaction
Adds the logged-in user’s reaction to a comment and returns the full populated comment.string
required
The Sublay comment ID.
ReactionType
required
One of:
"upvote", "downvote", "like", "love", "wow", "sad", "angry", "funny".Promise<Comment>
removeReaction
Removes the logged-in user’s reaction from a comment and returns the full populated comment.string
required
The Sublay comment ID.
Promise<Comment>
fetchReactions
Fetches a paginated list of reactions on a comment, optionally filtered by reaction type.string
required
The Sublay comment ID.
ReactionType
Filter to a specific reaction type.
number
Page number (1-indexed).
number
Results per page.
string
Sort direction:
"asc" or "desc".Promise<{ data: Reaction[]; pagination: { page: number; limit: number; total: number; totalPages: number; hasMore: boolean } }>
getUserReaction
Gets the logged-in user’s reaction on a comment. Returnsnull if there is no reaction.
string
required
The Sublay comment ID.
Promise<{ reactionType: ReactionType | null }>
