CommentsEndpoint: R6 Class for Comments Endpoint

CommentsEndpointR Documentation

R6 Class for Comments Endpoint

Description

Handle all comments operations in the Notion API

Note: Access this endpoint through the client instance, e.g., notion$comments. Not to be instantiated directly.

Value

A list containing the parsed API response.

Methods

Public methods


Method new()

Initialise comments endpoint. Not to be called directly, e.g., use notion$comments instead.

Usage
CommentsEndpoint$new(client)
Arguments
client

Notion Client instance


Method create()

Create a comment

Usage
CommentsEndpoint$create(
  rich_text,
  parent = NULL,
  discussion_id = NULL,
  attachments = NULL,
  display_name = NULL
)
Arguments
rich_text

List of lists (JSON array) (required). Rich text object(s) representing the content of the comment.

parent

List (JSON object). The parent of the comment. This can be a page or a block. Required if discussion_id is not provided.

discussion_id

Character. The ID of the discussion to comment on. Required if parent is not provided.

attachments

List of lists (JSON array). An array of files to attach to the comment. Maximum of 3 allowed.

display_name

Named list (JSON object). Display name for the comment.

Details

Endpoint documentation


Method retrieve()

Retrieve comments for a block

Usage
CommentsEndpoint$retrieve(comment_id)
Arguments
comment_id

Character (required). The ID of the comment to retrieve.

Details

Endpoint documentation


Method list()

List comments

Usage
CommentsEndpoint$list(block_id, start_cursor = NULL, page_size = NULL)
Arguments
block_id

Character (required). The ID for a Notion block or page.

start_cursor

Character. For pagination. If provided, returns results starting from this cursor. If NULL, returns the first page of results.

page_size

Integer. Number of items to return per page (1-100). Defaults to 100.

Examples


notion <- notion_client()

# ----- Create comment
notion$comments$create(
  parent = list(
    page_id = "34033ea0-c1e4-81c4-afa0-d1ec98de4bec"
  ),
  rich_text = list(
    list(
      text = list(
        content = "Hello world!"
      )
    )
  )
)


# ----- Retrieve comment
notion$comments$retrieve("34033ea0-c1e4-8193-a220-001d29ae83c5")


# ----- List un-resolved comments from a page or block
notion$comments$list("34033ea0-c1e4-81c4-afa0-d1ec98de4bec")



notionapi documentation built on April 13, 2026, 9:07 a.m.