Revisiting Workflow’s IFTTT Functionality

Although Workflow’s recently added support for API interaction, it’s already been possible to create workflows that interact with many online services already, albeit in a more basic way. Back in June, Workflow added support for IFTTT, a web automation service that makes it simple to connect hundreds of different services to each other.

IFTTT functionality within Workflow is something that I feel is too easily overlooked. I rarely see any workflows that make use of this integration, and even I don’t make much use of it. In fact, the only workflow at Workflow Directory that uses IFTTT is one that I wrote to demonstrate its functionality—a workflow that triggers an IFTTT recipe to call your phone and get you out of an awkward situation.

Workflow’s API support opens up so many possible uses but it can get really complicated very quickly. It’s worth keeping in mind that some of the functionality you’re looking to achieve could be done much more easily with IFTTT1. After spending some time exploring what’s possible, I’ve created some examples of IFTTT-powered workflows that demonstrate the usefulness of this action.

Post to Medium

Only a handful of iOS apps support posting to Medium, each of which has slightly different limitations or requirements. Using Workflow, it’s possible to send Markdown-formatted text from almost any app and post it to Medium. Thanks to IFTTT’s extensive Medium support, it’s also possible to specify tags, publication ID, and even a canonical URL if you’re cross-posting a piece you’ve published somewhere already. Interestingly, IFTTT’s support for Medium is actually better than most iOS apps that provide some sort of Medium integration.

This workflow, used as an action extension with any Markdown-formatted text, uses this IFTTT recipe to create a published post on Medium. The workflow prompts for a title, tags, and canonical URL (if required) during the process before it’s published. If you prefer, you can edit the recipe so that the post is unlisted or also added to a publication.

If you edit the recipe to have IFTTT create a draft post instead, tags are not included and need to be added when you edit the draft.

Create GitHub issue

I’ve covered using the GitHub API in Workflow before, but you don’t need to start delving into that if you just want an easy way to create GitHub issues. Using this workflow and IFTTT recipe, you can create an issue within the GitHub repository you specify. There’s also provides an option to include a photo or screenshot when creating the issue. To accommodate this, the workflow uploads it to Dropbox and gets a direct link to use within the issue description.

Creating a GitHub issue using Workflow and IFTTT

Subscribe to RSS feed in NewsBlur

This workflow makes me wish I had spent more time looking into Workflow’s support of IFTTT. I’d been looking into the NewsBlur API to create a workflow that subscribes to a site I provide, but this is something that I can do just by using IFTTT. This workflow makes use of this recipe and detects the RSS feed of a website, then passes it to NewsBlur to subscribe to.

  1. There might even be services that you want to make use of which don’t have a public API but are available through IFTTT. 

Using Workflow to Perform OCR

Microsoft’s Cognitive Services (née Project Oxford) is an interesting collection of APIs that leverage machine learning to determine useful information about any provided data. One useful example of the APIs available is the Computer Vision API. It offers OCR functionality that detects any readable text within an image and outputs the results as plain text. Thanks to Workflow’s new API support, we can harness the power of machine learning to perform some very quick, and very accurate, text recognition.

This workflow prompts you to either select a photo or take one with the camera, then uses it to make an appropriate API request. The detected text is returned back and displayed as plain text that can be easily shared or copied to the clipboard.

OCR of a Notes screenshotOCR of a photo taken of a page in a book

Cool, right? Well it gets even better. The Computer Vision API can OCR images containing text in different languages so Workflow can also translate the detected text into our chosen language. The workflow includes a Translate Text action so you can try this for yourself.

After the OCR process, text can be translated within Workflow

This is really useful, especially when traveling. For instance, if you’re on vacation and are wondering what a street sign means, just run this workflow and take a photo, and you’ll get a translated version of the text.

Similar to other API services, an API key is needed to authenticate your requests. Just register for the service and copy/paste the appropriate subscription key for Computer Vision. There are also some size limits (both file and resolution) you need to consider so I recommend reading through the relevant documentation.

Workflow and APIs

In what is most certainly an early Christmas present for people like myself, Workflow has just received one if its most significant updates-extensive support for making API requests. I can’t emphasize enough how useful this is and the impact it’s going to have when it comes to iOS automation.

Workflow’s “Get Contents of URL” action has been overhauled to provide support for GET, POST and PUT request methods, including custom header information. The action also features an easy-to-use way of creating a request body that handles the formatting and escaping of values automatically. This opens your workflows up to all kinds of interactions with many APIs, such as Stripe or GitHub.

To demonstrate just how powerful this revamped action can be, I’ve created a few example workflows that leverage some popular APIs. These examples don’t perform any sort of error handling, nor do they represent what the limits of Workflow are. Consider these workflows a starting point for building your own.

A word about API keys

Keep them secret, keep them safe.
– Gandalf the Grey hat

Interacting with an API almost always requires some sort of API key or token. This is usually a string of random characters that can be used to directly perform actions on behalf of your account. If someone were to obtain this, they can not only access your account information but also perform actions on your behalf.

If you create a workflow that you want to share, make sure to remove your API key from it beforehand!

GitHub: Create Gist

This is a workflow I’ve always wanted to create, and the new API support makes it possible. Gists are great to share small pieces of text information, such as code snippets or scripts. This action extension workflow accepts files of any type (though they must be text-based) and creates a gist using the GitHub API.

You need to create a GitHub personal access token before you can use this workflow. GitHub allows you to create multiple access tokens with different permissions. For the purpose of this workflow, I recommend creating a token that can only be used to work with gists.

Stripe: Get Recent Charges

Stripe is a payments platform that’s built for developers. This workflow retrieves some basic information about the last three charges processed on your Stripe account, such as:

  • Charge ID
  • Amount
  • Last four digits of the card used

To use this workflow yourself, include your test or live secret API key, depending on whether you want to retrieve test or live payment information.

Stripe: Create a Payment

This is an excellent demonstration of Workflow’s API support–use Workflow as a point-of-sale device! This workflow prompts you to enter credit card information and an amount to charge, along with some additional information, then creates a payment.

Create a payment on Stripe using Workflow

A notification is displayed once the payment has been processed and a link to the payment in your Stripe Dashboard is copied to the clipboard.

A payment created with Workflow

Stripe: Create a Customer

Moving on from creating payments, this workflow creates a customer object using the information you provide. A link to the customer object in your Stripe Dashboard is also copied to the clipboard.

Digital Ocean: Create Droplet

Digital Ocean is a cloud computing platform that makes it easy to deploy a server (droplet) in just a few seconds. Using its API, this workflow creates a new droplet using the information provided, such as the Linux distribution, how much RAM it should have, and the datacenter location.

Digital Ocean: Get Droplets Info

This workflow simply retrieves a list of all your current droplets and provides the following information for each:

  • Name
  • ID
  • IP address
  • Status