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.
Methods
Method new()
Initialise comments endpoint.
Not to be called directly, e.g., use notion$comments instead.
Usage
CommentsEndpoint$new(client)Method create()
Create a comment
Usage
CommentsEndpoint$create(
rich_text,
parent = NULL,
discussion_id = NULL,
attachments = NULL,
display_name = NULL
)Arguments
rich_textList of lists (JSON array) (required). Rich text object(s) representing the content of the comment.
parentList (JSON object). The parent of the comment. This can be a page or a block. Required if
discussion_idis not provided.discussion_idCharacter. The ID of the discussion to comment on. Required if
parentis not provided.attachmentsList of lists (JSON array). An array of files to attach to the comment. Maximum of 3 allowed.
display_nameNamed list (JSON object). Display name for the comment.
Method list()
List comments
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!"
)
)
)
)
#> {
#> "object": "comment",
#> "id": "34033ea0-c1e4-8193-a220-001d29ae83c5",
#> "parent": {
#> "type": "page_id",
#> "page_id": "34033ea0-c1e4-81c4-afa0-d1ec98de4bec"
#> },
#> "discussion_id": "34033ea0-c1e4-816e-b659-001c804acf56",
#> "created_time": "2026-04-12T21:19:00.000Z",
#> "last_edited_time": "2026-04-12T21:19:00.000Z",
#> "created_by": {
#> "object": "user",
#> "id": "6b786605-e456-4237-9c61-5efaff23c081"
#> },
#> "rich_text": [
#> {
#> "type": "text",
#> "text": {
#> "content": "Hello world!",
#> "link": {}
#> },
#> "annotations": {
#> "bold": false,
#> "italic": false,
#> "strikethrough": false,
#> "underline": false,
#> "code": false,
#> "color": "default"
#> },
#> "plain_text": "Hello world!",
#> "href": {}
#> }
#> ],
#> "display_name": {
#> "type": "integration",
#> "resolved_name": "brenwin-internal"
#> },
#> "request_id": "9d02c544-abcc-4224-bd68-6009ea129c89"
#> }
# ----- Retrieve comment
notion$comments$retrieve("34033ea0-c1e4-8193-a220-001d29ae83c5")
#> {
#> "object": "comment",
#> "id": "34033ea0-c1e4-8193-a220-001d29ae83c5",
#> "parent": {
#> "type": "page_id",
#> "page_id": "34033ea0-c1e4-81c4-afa0-d1ec98de4bec"
#> },
#> "discussion_id": "34033ea0-c1e4-816e-b659-001c804acf56",
#> "created_time": "2026-04-12T21:19:00.000Z",
#> "last_edited_time": "2026-04-12T21:19:00.000Z",
#> "created_by": {
#> "object": "user",
#> "id": "6b786605-e456-4237-9c61-5efaff23c081"
#> },
#> "rich_text": [
#> {
#> "type": "text",
#> "text": {
#> "content": "Hello world!",
#> "link": {}
#> },
#> "annotations": {
#> "bold": false,
#> "italic": false,
#> "strikethrough": false,
#> "underline": false,
#> "code": false,
#> "color": "default"
#> },
#> "plain_text": "Hello world!",
#> "href": {}
#> }
#> ],
#> "display_name": {
#> "type": "integration",
#> "resolved_name": "brenwin-internal"
#> },
#> "request_id": "fef63af9-6554-4ead-b9b0-1d086df21038"
#> }
# ----- List un-resolved comments from a page or block
notion$comments$list("34033ea0-c1e4-81c4-afa0-d1ec98de4bec")
#> {
#> "object": "list",
#> "results": [
#> {
#> "object": "comment",
#> "id": "34033ea0-c1e4-8193-a220-001d29ae83c5",
#> "parent": {
#> "type": "page_id",
#> "page_id": "34033ea0-c1e4-81c4-afa0-d1ec98de4bec"
#> },
#> "discussion_id": "34033ea0-c1e4-816e-b659-001c804acf56",
#> "created_time": "2026-04-12T21:19:00.000Z",
#> "last_edited_time": "2026-04-12T21:19:00.000Z",
#> "created_by": {
#> "object": "user",
#> "id": "6b786605-e456-4237-9c61-5efaff23c081"
#> },
#> "rich_text": [
#> {
#> "type": "text",
#> "text": {
#> "content": "Hello world!",
#> "link": {}
#> },
#> "annotations": {
#> "bold": false,
#> "italic": false,
#> "strikethrough": false,
#> "underline": false,
#> "code": false,
#> "color": "default"
#> },
#> "plain_text": "Hello world!",
#> "href": {}
#> }
#> ],
#> "display_name": {
#> "type": "integration",
#> "resolved_name": "brenwin-internal"
#> }
#> }
#> ],
#> "next_cursor": {},
#> "has_more": false,
#> "type": "comment",
#> "comment": {},
#> "request_id": "d97cd273-a5dd-4fb6-86d3-84c4d4bc8ebe"
#> }
