The Complete Beginner’s Guide to Apple Shortcut Deep Linking for Developers

At some point, all developers find themselves wondering how to add deep linking to their shortcut. This guide will show you everything you need to know about apple shortcut deep linking, from the basics to the more advanced tips and tricks.

Darshit Shah
Infonity Tech

--

Apple opened SiriKit intents for limited domains based on the type of apps like Messaging, Lists and Notes, Workouts, Payments, VoIP Calling, Visual Codes, Photos, Ride Booking, Car Commands, CarPlay and Restaurant Reservations.

As developers, we all know how critical it is to have a good user experience. Recently, Apple has made it possible to add deep linking capabilities to your iOS applications. This allows developers to take their users directly to a specific page within their app rather than the home screen. This is called deep linking. Apple Shortcut Deep linking is a new feature that was introduced in iOS 12.0. In this post, I will show you how to add deep linking to your shortcuts.

Siri Shortcuts were introduced by Apple in iOS 12. Siri Shortcuts is a solution to a SiriKit limitation. You can now ask or train Siri to perform your workflows.

Apple Shortcut app: https://itunes.apple.com/app/shortcuts/id915249334

We’ve all seen how to create workflows and how to create custom workflows from applications, but most of us are unaware that we can also deeplink in shortcuts. Shortcuts enable us to open or run shortcuts, open galleries, and search for specific types of shortcuts.

The URL Scheme for the Shortcut app is shortcuts: //

Deeplinking parameters

name — Name of the shortcut.

inputInput is the string input to the shortcut which you are going to run.

These are the fundamental parameters that allow you to open or run any shortcut. Let’s take a look at how we can open or run any shortcut.

Open (not run) a specific shortcut

shortcuts://open-shortcut?name=[name]

Running a specific Shortcut

shortcuts://run-shortcut?name=[name]&input=[input]

Isn’t it simple? But how do we know if the shortcut was successful or not? Apple, on the other hand, provided this feature as well.

x-callback-urlCallback url is responsible for sending response back after exclusion of shortcut.

shortcuts://x-callback-url/run-shortcut?name=[name]&x-success=[url]

Callback URL work with 3 parameters:

x-success — To handle Successful execution

x-cancel — To handle interruptions in execution

x-error — To handle errors in execution

You can specify your application URL Scheme to open app once shortcut execution completed

shortcuts://x-callback-url/run-shortcut?name=Make%20PDF&x-success=sampleapp://status=0

Note: URL should be URL-encoded and Shortcut should be added to the library.

https://www.icloud.com/shortcuts/c5e23f99886c42d7be3883bd5df8a973

Here is simple Bluetooth TurnOn shortcut file. Add this to library of your shortcut app.

Below is sample code to run shortcut and on success it will trigger ‘shortcutDemo://status=1’ (URL Scheme: shortcutDemo).

Shortcut for Bluetooth Turn on

Shortcut links

Import a Shortcut

shortcuts://import-shortcut?url=[url]&name=[name]

url — URL for a. shortcut file

name — Name of the shortcut

You can &silent=true in url for importing shortcut in library without opening Shortcut app.

Open the Shortcuts Gallery

shortcuts://gallery

Search the Shortcuts Gallery

shortcuts://gallery/search?query=[query]

Conclusion

You make any workflow related to your application and make SiriKit work for you OR you can call another application shortcut from your application.

Give your support

If you found this post useful, please share it with others.

Keep an eye out for the next interesting article. 😇
I hope you enjoyed it, and have a productive development day. 😀
If you have any new ideas or suggestions, please leave them in the comments section below.

Thank you for reading. 👍

--

--

Darshit Shah
Infonity Tech

Sr. Software Developer, Passionate for App UI/UX, Blogger