How can efficiently add a tree of subnodes to a new inbox node?

Hey!

I’m currently developing a small Chrome Extension (Sneek Peek). The basic functionality is that you can highlight text on a website and then send all the highlights over to Dynalist.

I currently implemented it this way. In short, I add the link to the website to the inbox, wait for the node_id to come back and then insert all the highlights into the node by mapping over them.

Is this the right approach?

For me, it would feel more natural to send over a JSON object with all the nodes in one request instead of adding one node at a time.

2 Likes

That looks good. I currently use Liner for that, which doesn’t have an export to Dynalist.

Sorry I can’t advise on the coding.

That sounds like a reasonable addition to the API. We’ll consider how to implement this a bit later, meanwhile I’ll have this tracked on our todo list.

1 Like

I also used liner, because it’s the best tool where you can easily copy the highlights.

Are you also using it annotate?

I’m planning to extend the extension so you can annotate on the site and it then adds annotation as a note to highlights.

I think it’s a valuable addition that helps to reduce the number of requests. In the best can I only would need to make the request to the inbox path.

I don’t use it to annotate. I would add something once it had been imported. Nonetheless, it doesn’t hurt to have that capacity.

How do you actually know which file_id the inbox belongs to? It seems like the API does not return the file_id, or do I miss something?

I don’t know that (Sadly). I just query all the files and per default set the first file in the list as the Inbox. Therefore the highlighter inbox in my settings is disconnected from the inbox settings in Dynalist.

Old topic, but I happen to know the answer: The “send ot inbox” API call actually returns the document ID and the new node ID. From the API docs:

{
  "_code": "OK", // succeeded, an error code will be returned otherwise
  "_msg": "",
  "file_id": "<inbox document ID>",
  "node_id": "<new node ID>",
  "index": 0 // where the new item was placed in the inbox
}