Here’s a brief video demo on YouTube showing the actions in use
On the Drafts Directory:
At first run of either action, a credential identifier called “writeas” is created, which will prompt you for “Collection” and “Access Token.”
“Collection” is just the backend term for blog (correct me if I’m wrong there,) so you should enter the lowercase slug of your blog. (Ex:
write.as/bilge.) “Access Token” is referring to a WriteFreely/Writeas/Snapas API token. (See: the docs.)
Post to Writeas will publish the current draft contents as an anonymous/“unclaimed” post. These are accessed in the “Posts” menu at
/me/posts/. The URL of the result is then inserted at the cursor (in Drafts) as a markdown-formatted hyperlink.
Post to Writeas Blog will publish the current draft contents as a new post on the blog you specified at credential creation. The URL of the result is then inserted at the cursor (in Drafts) as a markdown-formatted hyperlink.
I intend to continue exploring the possibilities of this integration and perhaps eventually publish a dedicated “Action Group.” I’d especially love to hear from any Drafts users also using Writeas/WriteFreely.
That’s awesome, @DavidBlue! Drafts is a great writing environment, and I love the integration work that Greg at Agile Tortoise has put into the app. It really is a fantastic central point for get thoughts out of your head, and out to whatever home they need to get to.
One interesting thing is that while you can have Drafts “forget” the credentials for the service, all that does is delete the credentials from your device. In your case, since you’re using an access token, you’d normally want to send a
DELETE request to the Write.as API to invalidate the token, so that it can’t be reused — but the Drafts Actions scripting reference doesn’t seem to provide a way to do that.
That means that if someone wants to delete this access token, it’s up to them to
- remember their access token, and
- make that API request manually.
It’s a bit fiddly, but if you’re already fetching that token yourself, you’re probably savvy enough to delete it yourself.
One question for you, though: both the Post to Writeas and Post to Writeas Blog actions take a
collection — it seems to me that would only be necessary for the Post to Writeas Blog action. Is there a reason you’re requesting it for both?
Only to simply things for someone intending to use both or the latter, basically, by unifying them under a single credential identifier. Maybe I should include a note in the setup step about this? It’s either that or I could set it up so the collection has to be manually identified every time in the latter, which I don’t think would be too much to do every run.
Gotcha, that makes sense!
Awesome @DavidBlue. I’d love to use Drafts. May I ask how you get the Write.as API key? I’ve searched all over and can’t find out how to get my key.
oh my goodness I am just seeing this now!!! for some reason. so sorry about that.
first, here’s the "Authenticate a User heading" in the API documentation for a reference on how to do it manually.
hopefully though, if you’re on Apple platforms, my Siri Shortcut specifically for this function will prove the straightest-forward method of retrieving your key.
I don’t know why it didn’t occur to me sooner, but I just put up a quick shortcut for actually retrieving any public write.as post’s body text via the API: Get Write.as Post Text
By default, it just copies the text to the system clipboard, but - as I noted on the RoutineHub page - you could append an action from any application(s) that saves text. Here’s my personalized example for Drafts:
This one does not require authorization, FYI.
@DavidBlue Cool, what kind of use case do you see for this new shortcut?