Set up Shortcuts on iOS
In this tutorial, we will set up Shortcuts on iOS and add a widget to your home screen to add new tasks to your lists.
Get started by opening Shortcuts app. Usually, this app is already preinstalled on your iOS device. If not, install it from the App Store.
On the main screen listing all available shortcuts, click the plus button in the header to create a new shortcut. Name your shortcut any way you like, and pick an icon for it.
Now, we configure the actions. The first action taking place when pressing the widget will be to prompt you to enter the name of the newly created task. Press "Add Action", select "Scripting" actions, and find "Ask for Input". Once added, you can set the prompt (e.g. "Enter task name").
Next, we configure another action to send this information into Lunatask. Slide up the list of available "Scripting" actions from the bottom of the screen and press the "X" icon to close "Scripting" section, returning you to the list of all available actions. Select "Web" actions and find "Get Contents of URL".
Now, we configure where the task should be sent – tell Shortcuts to call Lunatask API. This is be somewhat technical, but following this tutorial exactly will get us there without too much effort.
https://api.lunatask.app/v1/tasks so the action says "Get contents of
https://api.lunatask.app/v1/tasks" instead of "Get contents of Provided Input".
Press the arrow icon to reveal more details – there, change the method from
Open "Headers" section and press "Add new header". Into the field for "Key", type "Authorization" and into the field named "Text", paste an access token.
To create an access token in our desktop app, head to the settings, "Access tokens" section, create a new access token naming it "iOS Shortcuts", and press "Copy to clipboard".
Thanks to Apple's Universal Clipboard feature, you can paste what you have copied into the clipboard on your Mac on your iOS device. This will be handy here.
Now, paste the access token as the value for "Authorization" key.
Next, tell shortcuts in which list the task should go in Lunatask. Under "Request Body" section, press "Add new field" and select Text type. As "Key", fill in "area_id", and as value, fill in the ID of the list where the task should be created.
You can find Area ID for each list by opening area settings in our desktop app and hitting "Copy Area ID" – the ID will be copied into the clipboard. Then, paste it to "Text" field on your iOS device.
If you do not wish to hardcode a single list in the shortcut, you can add a prompt into your shortcut and select where the task should be created for each of your new tasks. Use "Scripting" > "Choose from List" action for that. We will not cover it here, but once you finish this tutorial, you should know enough about setting up shortcuts to be able to set this up.
Next, add another field, name it "name" and upon focusing into "Text" field, select "Provided Input" from the toolbar.
The shortcut will now look like this:
Now, press the play icon in the bottom toolbar to test your shortcut – a popup should appear, prompting yor to enter the task name, and upon clicking "Done" and if we did everything right, the task should be created in the chosen list.
The last thing remains to add the shortcut as a widget to your home screen.
To do that, go to your home screen with all the icons of apps you have installed. Then, long press the home screen until all icons start to wiggle.
Press the "+" button in the top left corner of the screen to add a new widget, scroll down and in the list of apps, select "Shortcuts" and press "Add Widget".
Ufff, it took us a while, but the result is totally worth it 🙌