Shortcuts is an iOS app formerly known as Workflow used to automate various actions. With the advanced "Get contents of URL" action it can be used to make Micropub requests or upload files to a media endpoint.
A desciption of the (old) flow can be found at Shortcuts/Instagram POSSE
A new, pre-build version can be downloaded. This one makes use of a few other flows. After import, you can customize to your needs.
- The Location as Geo URI Shortcut for location: https://www.icloud.com/shortcuts/f88b056be79946699aa351d26efb348b
- The Fetch Micropub endpoint Shortcut for the endpoint: https://www.icloud.com/shortcuts/efeae51596784fb7844791d7159d642a
- The IndieAuth Shortcut for authentication: see below.
- The Post Photo Shortcut itself: https://www.icloud.com/shortcuts/fbdebaac81ae4de69cb623f7fbfa8bed
Note: currently Shortcuts is not able to parse the Location header out of the Micropub request. This means it cannot show you your new post, unless your Micropub endpoint returns the link also in the body. This is non standard, but the Shortcut will detect it and show you your post if it can. If you see your post and want to POSSE to Instagram after it, just return to the Shortcuts app.
Sebastiaan Andeweg made a Shortcut that does the IndieAuth dance for you, in order to pick up a token. It can be embedded into Micropub workflows, as it returns the token.
The current version required one weird copy-paste step, because iOS is not able to parse attributes after a redirect to the Shortcut app.
You can download the Shortcut here.
Micropub Media Endpoint
You can download a pre-built Shortcut that allows you to upload files to your media endpoint using the Share Sheet, or if the Shortcut is activated outside the share sheet it will present an option to upload from your Photos library or from the Files app.
You can download the Shortcut here
Creating Your Own Custom Shortcut
Create a new shortcut
- Accepts: Images, Media
- What type of shortcut? Action Extension
add the following items:
- URL: Set the URL to your media endpoint
- Get Contents of URL: Advanced
- Method: POST
Authorization: Bearer XXXX(insert a Micropub access token)
- Request Body: Form
- file: Shortcut magic variable, choose "Shortcut Input"
- Show Notification: Contents of URL (This will display the response from your media endpoint so you can confirm the upload worked)