New Action: Generate a Draft listing metadata for all drafts in the active workspace

Ever needed to get a list of drafts to print or make a PDF from?

I created this action with the help of ChatGPT to generate a markdown list of all drafts in a selected workspace, complete with metadata. It offers:

  1. Display Options: “Card” or Table View
  2. Sort Options: Modified (Descending or Ascending), Created (Descending or Ascending), or Alphabetically (A–Z)
  3. Group Option: Group Flagged drafts at the top
  4. Configurable Default Options: You can set your own default options for the category, output format, sort by, and group.

Get it here: Generate Markdown of Drafts

1 Like

This is a useful action @jochi – thank you for sharing…

But honestly, I’m more interested in the process you used to create it…

Would you share some of the prompts you used - would be helpful in generating more Drafts actions – for myself and likely others.

Many thanks.

1 Like

Sure…

ChatGPT has knowledge of the Drafts API up to September 2021. I didn’t try this, but if you have the Pro version you can use GPT 4 and Bing to browse more recent documentation to take advantage of more recent updates.

The prompt I started with just asked ChatGPT to create a script action in JavaScript to have Drafts generate markdown for all the Drafts in the active Workspace. To help it along, I gave it a template of how I wanted the markdown formatted.

It did that easily, but just output the result to the console, so I told it to put the output in a new Draft. With that, I put the code in a new Action and ran it. Worked great. Of course this — and each successive version — led me to more and more ideas to enhance it.

When the script would fail (as it did several times) I would paste the error message to Chat and it would explain what it thought the problem was and rewrite the script.

At one point, it seemed to run into a problem it couldn’t figure out (sorting by date). I almost gave up, but asked it to rewrite the script in functional style. That forced stylistic rewrite seemed to do the trick to get it to rethink what it had written.

It helps to have an understanding of JavaScript and the Drafts API so you can understand the output, but I was very happy to create an action of some complexity in hours that would have taken me days or more to write.

Does that help?

1 Like

Fascinating approach and use case! Thanks for sharing your process- blazes a path worth following.

1 Like

this is really something I experienced, too.
sometimes GPT just makes up things that are not part of the Drafts API. If you get an error and can point it to use the correct API it will speed up the process to create the script you want a lot.

It helps to be very precise about the output you want to have in your query and should give you a good starting point.

2 Likes