Viewing & Linking Dropbox folder contents in Drafts?

This is a followup on a discussion about integrating Drafts with Scrivener. Thanks to @sylumer for their response in that thread.
From Drafts 5 to Scrivener? - #5 by mathewjones

Hi all,

I’m new to Drafts and am very excited about integrating it with Scrivener.

Using the Drafts Dropbox action to add notes to the Scrivener Scratchpad works great! After synching, when I open Scrivener, the updated Scratchpad entries are already there. Perfect.

Now, does anyone have a suggestion for doing the reverse? That is, viewing the Scrivener Scratchpad within Drafts?

I would like to create a Drafts action to show me the Scrivener Scratchpad, similar to how I would see it in Scrivener. That is:

  1. read the file list of the Scrivener Scratchpad from Dropbox (i.e., just the file list, with correct links to each file).
  2. create a new Draft, with a list of the Scratchpad files. Ideally, the new Draft would have a title something like “Scrivener Scratchpad [[date]]”. And ideally, would be autopopulated with tags like #scrivener, #scratchpad, dropbox, etc.
  3. Ideally, each entry in the list should be formatted as a link that I can click to load the original file from the Scratchpad.

Any ideas to get me started, please?

I am not very familiar with Drafts actions, Apple Shortcuts, or Javascript, although I’m familiar with coding in general.

Cheers,
Matt

To simplify my request to the barest bones:

Q: Is there a Drafts action, Apple Shortcut or Javascript command that I can use to extract the file list in a Dropbox directory? Such as I would obtain with a *nix command like “ls”?

Thanks,
Matt

You can work directly with the Dropbox API, but I’m not sure that’s the easiest way to do things.

I’d suggest creating a Bookmark pointing to the folder in Dropbox you want to work with, and use the FileManager script object to work with those files. It can be instantiated for a bookmarked folder and has methods to read the file list (listContents).