Figma api: comments

Hi, does Figma in any way allow to interact with comments through it’s api? I.e. retrieve data?

thank you @tank666

Continuing this question - I am able to retrieve all comments for a file using REST api, I was however wondering if there is a way to only retrieve comments for a specific page? or perhaps filter comments using page ID somehow? As there might be a lot of comments :confused:

Use comment.client_meta.node_id to get the node and, if required, its parent.

My goal is to be able to specify a page (name or ID) and extract the comments from the given page.

Considering your reply - how does one return the parent of the comment.client_meta.node_id? I could filter the comments based on that, but I seem to be stumbling on that part.

The only solution I’m currently finding is making a separate request which looks through the document->page->children and then having to manually match the output of that to comment.client_meta.node_id to see if it’s on I page I want to check for comments.

Maybe I’m missing a simple keyword or something here… Thanks again!

figma.getNodeById(comment.client_meta.node_id)

Or an asynchronous function (getNodeByIdAsync).

And if the node type is not page, check its parent.

node.parent

and I’m guessing there’s no REST api to do the same?

The REST API has endpoints such as GET file and GET file nodes. Use them to find the required IDs in the JSON response.