Functions

build-comment-payload

fn (target: Map, text: Str): Map

Build the create-comment payload. target is {page_id} to start a new discussion on a page, or {discussion_id} to reply to an existing one. Exposed for testing; create-comment uses it.

Example

::notion::comments/build-comment-payload({page_id: "p1"}, "Hi").parent  // {page_id: "p1"}
::notion::comments/build-comment-payload({discussion_id: "d1"}, "Hi").discussion_id  // "d1"

create-comment

fn (target: Map, text: Str): Map
fn (target: Map, text: Str, opts: Map): Map

POST /comments - Comment on a page (new discussion) or reply to an existing discussion. Requires the integration's Insert comments capability. Notion's API cannot delete or resolve comments.

Example

::notion::comments/create-comment({page_id: "59833787-2cf9-4fdf-8782-e53db20768a5"}, "Looks ready to ship.")

list-comments

fn (block-id: Str): Map
fn (block-id: Str, options: Map): Map
fn (block-id: Str, options: Map, opts: Map): Map

GET /comments?block_id= - The unresolved comments on a page or block. options (2-arity) supports page_size (max 100) and start_cursor; returns {results, has_more, next_cursor}. Requires the Read comments capability.

Example

comments ::notion::comments/list-comments("59833787-2cf9-4fdf-8782-e53db20768a5", {page_size: 50})
map(comments.results, (c) { ::notion/plain-text(c.rich_text) })