- App Store
- URL Scheme: twitter://
- URL Scheme Documentation: Not officially documented
The first time you run this action, you will be directed to Twitter to login and allow Drafts permissions to post to your account.
Twitter action steps support multiple accounts using the Drafts Credentials system. You can duplicate the Tweet action above, swipe to right on the action and select “Edit”. Open the steps, then the Twitter step, and insert a “Credential identifier” value.
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 right account in Safari to complete this process and link the action to the right Twitter handle.
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 setup 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
Twitter actions are great candidates to set the After Success setting to archive or trash the draft automatically…leaving you ready to move on to the next draft right away. See advanced action settings article for details.
URL Actions for Twitter Clients
Many Twitter client apps, including the official Twitter app, also support URL schemes to pre-fill their compose window. If you are regular user of Twitter, it is handy to also have a URL-based action for your favorite Twitter client install - 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 for popular clients can be installed from the directory:
Advanced Twitter API Scripting
Drafts also exposes the complete Twitter API to scripting via the Twitter object. The API is too broad to cover here, but it can be used to read information from Twitter, download timelines, etc., as well as post to tweet. Below are two sample actions demonstrating advanced use of the API:
- Tweet Storm: Breaks a longer draft into paragraphs, shows a preview of how it would be tweeted as a multi-tweet threaded tweet storm - and then posts those tweets if preview is confirmed.
- Twitter API: Get Likes: Downloads recent favorite/liked tweets for any user and creates a new draft with their content.
- Import Twitter Search: Prompts for search text, gets a list of matching tweets and creates a new draft with a list of tweets in Markdown format.