Showing prompts in your workflow
If you want to display or enter information during the course of running your workflow, you can use the Ask for Input, Show Alert, or Show Notification actions or an Ask When Run variable.
With these features, you can create workflows that are more dynamic, where you set a structure for what will happen in your workflow but don’t have to fill in all of the information while building it. Instead, you can leave certain options to be decided at runtime.
Ask for Input is a powerful action that allows you to enter information at the time your workflow is run. This action presents a text entry dialog where you can provide a response to a question. Once you enter your text and tap “OK”, the data is passed into the next action or stored as a Magic Variable to retrieve later.
Ask for Input supports entering text, dates, or a number, with the keyboard adapting to each input type. Plus, Ask for Input allows you specify a default value to prefill into the dialog and adjust when the workflow runs.
The Ask for Input action is useful when you need to add new data to your workflow that isn’t available during the building phase and needs to be inserted at runtime. It works well with “logging” workflows, such as ones that log Health data or create journal entries.
When an Ask for Input action is set to Number, you can use it to quickly enter numbers in the Today Widget using a number pad (learn more in Using workflows from the Today Widget). On Apple Watch, you can enter numbers, dates, and text via dictation or the Scribble feature (learn more in Using workflows from Apple Watch).
Similar to how Ask for Input asks you to enter information, the Ask When Run variable allows you to tweak the parameters of an action at runtime. With the Ask When Run variable, you can wait to choose how an action should operate until the workflow is run.
As your workflow runs, it will complete each step until it comes across an Ask When Run variable in an action. The workflow will pause, prompt you to update the action’s parameters, and proceed when you tap “Done.”
To use Ask When Run on parameters, tap the empty space in the action around the parameter and you’ll be presented with a variable picker where you can choose Ask When Run. Then, each time your workflow is run, you’ll be asked to confirm your desired option for that parameter. To insert Ask When Run in actions with text fields, tap in the text field and look for Ask When Run in the variable bar above the keyboard.
Using Ask When Run on a parameter can be helpful for tweaking options on the fly, such as whether to Show Compose Sheet in the Send Email action.
With the Show Alert action, you can present an arbitrary dialog with a title, a description, an “OK” button to continue, and an optional “Cancel” button (which will stop the workflow if tapped). Show Alert can be used to show information to the user, provide warning messages, pause the workflow at a certain point, and more.
Show Alert is especially handy for displaying information in the Today Widget or on Apple Watch. For example, you could have a workflow that determines sunrise and sunset times and at the end shows an alert with a summary.
You can also use Show Alert to debug workflows when you’re not getting the intended result. By passing content into Show Alert, you can preview the output of the previous action, see what’s going on at that point, and cancel the workflow if needed.
The Show Notification action will create a system notification that contains content of your choosing. Show Notification runs instantly and continues to the next action (unlike Show Alert, which pauses the workflow with its prompt).
The notification displays a rich preview of any media that’s passed into it, like an image or a Maps location.