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.
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.