Automating Write.as Posts on macOS
A setup for posting to Write.as blogs directly using Siri Shortcuts, the Write.as CLI, and (optionally) Drafts for Mac.
Though there is currently a Write.as desktop application in the works for macOS and the web editor is certainly no slouch, I thought I'd attempt to take advantage of my newfound knowledge of the Write.as CLI, Drafts Actions, and Siri Shortcuts on macOS to manifest one of my all-time dream integrations: publishing directly to write.as with Drafts.
To start – assuming you already have the CLI installed – lets run
writeas help post in our shell:
For my own use, I really needed to consider just two arguments, here: which blog I'm posting to and in which format. Since my blog's CSS overwrites all but
monospace, I always publish in
--sans. Keeping this in mind, I allotted for these two options in my Siri Shortcut as customizations set on install.
Now, whenever it's run, my shortcut will be running this command:
write-as post -c chaff --font sans plus whatever input I've given it. By default, it will grab from the clipboard, but I'm going to use a custom Drafts action to send input, instead.
Very simply, this action simply calls a shortcut entitled “Post to Write.as Blog (macOS)” sending the [[safe_title]] of the Draft as the markdown title followed by a space and then the draft's [[body]].