Learn how to use Shortcuts to periodically query an external API and pass multiple inputs to a Pushcut Widget.
Step 1: Create the Quote of the Day Widget and its Content
Then, create a new Quote Widget and set its default content to your new Quote Content.
Step 2: Create a shortcut to update your widget
Using the Shortcuts app, create a widget with the steps outlined on this screenshot. You can also directly import this shortcut on your device using this link.
We use the Get Contents of URL built-in Shortcut action to make a GET request to the They Said So Quotes API and proceed to parse the returned JSON object using the Get Dictionary From Input and Get Item from List actions.
Since we'd like our Widget to display both the quote and its author, we must pass two inputs to it. In order to do so, we use the List action to organize them into a single object that we'll later pass as the input of the Update Widget action.
You can tap on the play button on the bottom-right corner of your screen to test and see if everything is working! Keep in mind that, because of how iOS controls widget updates, it may take a while (up to 15 minutes) before the widget is actually updated.
Step 3: Setup your daily automation
To avoid having to create many repeated automations to update your widgets, let's organize all shortcuts that should run daily on a "parent shortcut" that will execute all its children.
Create a new Daily Pushcut Widgets shortcut, choose the Run Shortcut action and choose the Update Quote Widget shortcut you just created.
Step 4: Set up the automation and that's it!
If you haven't done it yet, using the Shortcuts App create a new Automation that will execute your Daily Pushcut Widgets shortcut everyday. As always, make sure the Ask Before Running is disabled if you'd like to avoid receiving a notification everytime your automation is executed. If you need more details on how to do this, check out our Milestone Widget Guide.
And that's a wrap! You can use what you've learned with this guide to connect your widgets to any other services that provide an accessible API or you can go a step further and use one of the supported [integration services/support/integrations) to update your widget anytime a compatible services generates new information.