Functions

build-comment-payload

fn (target: Map, content: Str, author-member-id: Str): Map

Build the create-comment payload. target is {object, record_id} to start a new thread on a record, or {thread_id} to reply to an existing thread. Exposed for testing; create-comment uses it.

Example

payload ::attio::comments/build-comment-payload({thread_id: "thread-1"}, "Thanks.", "member-1")
payload.data.thread_id  // "thread-1"
payload.data.author  // {type: "workspace-member", id: "member-1"}

create-comment

fn (target: Map, content: Str, author-member-id: Str): Map
fn (target: Map, content: Str, author-member-id: Str, opts: Map): Map

POST /comments - Comment on a record (new thread) or reply to a thread. Comments require an author: a workspace member id from ::attio::workspace/list-members. Requires the Comments scope.

Example

me first(::attio::workspace/list-members().data)
::attio::comments/create-comment(
  {object: "people", record_id: "7f4e2a10-3b9c-4d2a-8f1e-6a5c9d0b1e23"},
  "Followed up by email.",
  me.id.workspace_member_id)

list-threads

fn (object: Str, record-id: Str): Map
fn (object: Str, record-id: Str, opts: Map): Map

GET /threads?record_id=&object= - The comment threads on a record (each thread carries its comments).

Example

threads ::attio::comments/list-threads("people", ::attio::recordsEC)
map(threads.data, %.id.thread_id)