Skip to main content

Method

client.comments.create(args: CreateCommentParameters): Promise<CreateCommentResponse>

Parameters

rich_text
array
required
An array of rich text objects that represent the content of the comment.
parent
object
The parent of the comment. Required if discussion_id is not provided.
discussion_id
string
The ID of the discussion thread to comment on. Required if parent is not provided.
attachments
array
An array of files to attach to the comment. Maximum of 3 allowed.
display_name
object
Display name for the comment.
auth
string
Bearer token for authentication. If not provided, the client-level auth is used.

Response

Returns a Comment object.
object
string
Always "comment".
id
string
The ID of the comment.
parent
object
The parent of the comment (page or block).
discussion_id
string
The ID of the discussion thread this comment belongs to.
rich_text
array
The rich text content of the comment.
created_time
string
The time when the comment was created (ISO 8601 format).
last_edited_time
string
The time when the comment was last edited (ISO 8601 format).
created_by
object
The user who created the comment.

Example

const comment = await client.comments.create({
  parent: {
    page_id: "page-id-123",
  },
  rich_text: [
    {
      type: "text",
      text: {
        content: "This is a comment",
      },
    },
  ],
})

console.log(comment.id)

Build docs developers (and LLMs) love