Browse the docs

Call an app and read its answer (x-callback-url)

Opens an app's x-callback-url address and waits for the app to send its answer back, so Drafts, Bear, Things, Ulysses, Shortcuts and others work both ways.

Call url and read its answer

Details #

Many apps can be driven with an address like drafts://x-callback-url/create?text=hello. This step adds three return addresses (x-success, x-error and x-cancel) that point back at Switchboard, opens the address, and waits. When the app answers, the items it sends back become the step's output: for create in Drafts that is uuid.

An app that answers with an error or is cancelled fails the step, with the app's message when it sends one.

Apps Switchboard already knows (Drafts, Bear, Things, Ulysses, Shortcuts, OmniFocus, Day One, Fantastical, Overcast) appear in the Add step picker with a form of their own; this step is for any other app that speaks x-callback-url.

New draft, then say its id
Do
  1. Call drafts://x-callback-url/create and read its answer
  2. Show “Draft {{ d.uuid }}”
Open in Switchboard to try it

Parameters #

ParameterTypeRequiredValuesWhat it does
urltextYesRequired. The app's address. Don't add the return addresses yourself.
intotextA variable that receives the items the app sent back.
sampleany value
timeoutany valueSeconds to wait for the app (default: the macro's own limit).

Every step also accepts label, onFailure, timeout and dryRunSafe.

Gotchas #

The app has to come to the front for most of these calls, so the step is not for background use. A dry run prints the address it would open and does not call the app.