Twitter x Drafts, For Real This Time

Actions

app-icon|105x105
app-icon|105x105

Twitter is wonderful*, but often you may have something you want to share on Twitter but would prefer to avoid getting sucked into your timeline. More so, you may have an idea for a tweet that is not fully formed. Enter Drafts. Drafts is a great place to jot down and craft those pithy witticisms, and its Twitter integration allows you to post directly from Drafts, without ever launching your Twitter client. This article is a brief review of some of your options for using Drafts with Twitter, including sample actions for more advanced integrations, like the Tweet Storm example action that allows you to craft and post entire threads.

_* Your mileage may vary_

Direct Posting with the Twitter Action Step

Drafts can post directly to Twitter using the Twitter action step. Example action:

The first time you run this action, you will be directed to Twitter to log in and allow Drafts permissions to post to your account.

Configuring Tweet Actions

Multiple Accounts

Twitter action steps support multiple accounts using the Drafts Credentials system. You can duplicate the Tweet action above, edit the action, selecting the “Twitter” step, and change the credential identifier to target a different account.

The identifier can be any value, but all Twitter action steps with the same identifier will use the same credentials (e.g. post to the same Twitter account). In the case of Twitter, I recommend filling in the Twitter handle you want to target. The first time you use each action with a unique identifier, you will be asked to authenticate again via Safari. Be sure you are logged into the correct account in Safari to complete this process and link the action to the correct Twitter handle.

Templates

The Twitter action step has a template. By default, the value of this template is the Drafts' [[draft]] tag, which will insert the full text of the current draft. It can also be handy to set up alternate actions for live-tweeting events, and similar, where the template is not only the [[draft]] tag, but also contains a hashtag or other content which will automatically be added when used - like [[draft]] #Oscars. This technique is demonstrated in the Tweet #AppleEvent example action.

After Success

Twitter actions are great candidates to use the After Success settings. For example, you might set your Twitter action to archive the draft and assign the tag “tweet” when run, getting the draft tweet out of your inbox, and making it easy to look up all your tweets later using a tag filter.

URL Actions for Twitter Clients

Many Twitter client apps, including the official Twitter app, support URL schemes to pre-fill their compose window. If you are a regular user of Twitter, it is handy to also have a URL-based action for your favorite Twitter client installed - this allows you to send text to that app, and complete composing the tweet - for example attaching an image or other media file - before sending. Example actions for popular clients can be installed from the directory:

Tweet Storm: Composing Full Threads

The Tweet Storm example action is a great tool for composing entire Twitter threads in Drafts.

tweet-storm-preview|690x391, 75%
tweet-storm-preview|690x391, 75%

The action takes a longer draft, splits it up into paragraphs, and composes a Twitter thread, with a separate tweet for each paragraph. The action adds the (1/3), (2/3), etc. numbering common on Twitter theads, and previews the resulting thread for you to confirm. The preview will validate the content to make sure each paragraph will fit in a tweet, and then if you “Continue” post each resulting tweet in the proper reply structure to be a thread.

Very handy when you have a lot on your mind.

Advanced Twitter API Scripting

Drafts exposes the complete Twitter API to scripting via the Twitter object. The API is too broad to cover here, but you can use it to read information from Twitter, download timelines, etc., as well as post a tweet. Below are two sample actions demonstrating advanced use of the API: