Workflow 1.1 is out and it’s a terrific update. I’ve been playing with it since last night and toying around with a few new actions. One that I came up with doesn’t necessarily use the updates to the app but was something I’ve been thinking about for a few days regardless.
I really like the first-party Twitter app a lot and have been using it consistently since last fall. But sometimes when the flood of chatter becomes too much for me and I need to retreat a little, I fall back to Tweetbot or Twitterrific, two other lovely apps. Right now I’m using Tweetbot again because of keyword filtering, which I sorely needed for a few weeks of sanity restoration. But there’s stuff that the native Twitter app does (cards, analytics, archive search, etc.) that simply aren’t available in third-party clients.
Take cards for instance. Twitter has cool media previews embedded in tweets that let you check things out without leaving the app, but you only see a link in a third-party client. I built a little workflow that lets you open the tweet you’re currently viewing in the Twitter app to take advantage of some of those additional features.
In order to to this, I had to figure out how to get the app to recognize the URL being passed to it. Basically, you copy the link to the tweet, which gets formatted as an https:// link, which of course will open in Safari by default. Once there, there’s a tiny button in the web UI to open in the app. I copied that URL and applied it to a workflow step.
So you run the https link through a “Replace Text” step and strip out everything before the status ID, which is a long string of numbers, and append it to a link that opens the Twitter app itself (starting with twitter://). I’ve never used regular expressions before, and I know that while everyone gets all fired up about them, I just never had a reason to. But I tried it today so that you could send any tweet URL to it and it would strip the username and prepare the ID properly. One period and one asterisk later, I’m a regex expert AMA.
Seriously, don’t though, I barely got this to work. If anyone has any beginner regex tips, though, I’m all ears.
Anyway, it looks like this, and you can download it here. As with most of my first draft workflows, it can probably be done better, so have at it. I thank you in advance.
02-17-2015, 7:05 AM
David Chartier linked to a better version with variables and all kinds of whiz-bang stuff that bypasses the copying I was doing and saves a step. Use this one instead (I know I will).
I really have to learn how to do these more complex things to take my game to the next level.