Applications frictionless with Siri Shortcuts

darthpelo
6 min readAug 24, 2018

--

In the mobile development environment, one of the big goals is to keep the users engaged after the installation of an application. The common problem is to “convince” the users to continually use the most important functions provided by the application.
Unfortunately, most of the time, to reach these functions the users must follow a “long” journey:

  • take the phone
  • unlock the phone
  • search for your application
  • open the application
  • find the function inside the application (tab bar, hamburger menu, lists etc)
  • and finally… use it 🤯

As anyone can understand, all of these steps bring most of the user to stop to use most of the applications on their phones.
Apple and Google know this problem and both are trying to improve iOS and Android to reduce the gap between the user and the keys function of every mobile application.

For Apple the solution is the virtual assistant Siri and with iOS 12 users can use Siri to interact, also in the background, with all the applications.

Siri, not just a voice tool

Since iOS 7 Apple improved Siri that starts to learn how we use our iPhones/watch so it can suggests us, on the Lock Screen, the “right” application based on where and when we interact with our devices.
This was the first attempt of Apple to try to help users to access easily the applications they need.
The second step was opened Siri APIs to some third party applications, so the users can use voice command to use them. For example to book a car ride or send money to a friend.

One interesting thing:
everything happens on the device side. Nothing is sent to Apple. All the information collected by Siri and all her deduction stay on the phone and the developers cannot read them.

Siri Shortcuts

This year, during the WWDC, Apple presented the third step in the process: Siri Shortcuts and Custom Intents.
Compared to the past this is a huge step forward. These the key points:

  • every application can inform Siri when the user access to a specific application section (shortcuts)
  • every application can inform Siri when the user makes a specific action (custom intents)
  • Siri continually learns every time the application shares user actions and based on where and when it starts to suggest the user when it’s time to make again these actions
  • The user can assign custom voice command to interact with the application also without open it

The two last points are the most important on applications frictionless prospective because Apple achieved to create a direct connection between users and applications keys functions. Could be a voice command or a Siri notification, now users can use applications without open them or opening directly the specific section they need.

Digital Health application, a perfect use case

The best use cases for the new Siri funtionalities are actions that users make frequentily as Apple engineers explained during the WWDC tech talks. There are a lot of applications typologies that can match this requirement, in particular in the digital health enverioment.

I developed a demo application that implements one common function for the health system: track how many time a patient took a pill. Take a pill is a frequent action that a patient makes multiple times during day/week so I decided to tri the new Siri functions with it.

I will skip the technical details, because I just follow the two sessions by Apple Introduction to Siri Shortcuts and Building for Voice with Siri Shortcuts to implement the logic necessary to use Siri Shortcuts and you can make the same. It’s very easy and Apple provide also a complete example.

TakeUrPill

TakeUrPill is a simple iOS application that help you to keep track the pills you took. It’s an open source project and you can clone/fork from here.

It has only 3 functions:

  1. Set pill’s name and ammount of pill you must take every time
  2. Register into the application that you take the ammount of pills you setted
  3. View all the pills you took

All the functions are accesible from the home page, but only the number 2 takes place in this section of the application, the others two happen in two different sections.

Home View

In more detail, to set pill name and ammount a user needs to

  1. open the application
  2. tap a button in the home view
  3. insert the information
  4. save

Same flow to check when he took pill in the past.

The flow is more easy when the user wants to store when he took the pill, just open the application and tap on a button. That’s all.

I described the flows because they give you the indication about which function of Siri matches better. A repetitive action with some parameters (pill name and ammount) fits perfectly with Siri Custom Intents. Instead access to a specific application section is a perfect behaviour for Siri Shortcuts.

In the first case, every time the user taps the button Took my pill, the application sends to Siri the intent I took {pill amount} {pill name} pill, where pill amount and pill name are two parameters chosen before by the user.

In the second case, every time the user opens the Pills History section, the application sends to Siri the shortcut List of all pills I took.

The new intentdefition configuration file where create application’s intents and responses. As you can see, it’s possible to set parameters and different schortcuts types for every intent.
SiriService struct in TakeUrPill

After the first use, you can check in Settings > Siri & Search > More Shortcuts that now it’s possible to associate a voice command to the two shortcuts just created.

Press the red button and record your specific voice command

You can also allow the user to create a new shortcut directly from your application (much better 😉)

There is a specific API to open the Siri Shortcuts setting, with also a default button UI from Apple

Siri suggestions

To test Siri’s suggestions you can use the developers options (Settings > Developer) when you are working on your application.

Instead to see Siri gives you real suggestions, you must be patience 🙂

There is no information in Apple documentation about after how many “donations” Siri has enough information to suggestion you when perform a shortcut. Based on my experience with TakeUrPill, Siri started to show suggestion after a week, but it’s important that your actions are repetitive and constant, like “take a pill” every day at the same time for a week 🙂

Shortcuts from Siri Suggestions widget
I used to ask Siri to show me the list of my pill in the morning, so only in the morning Siri showed the suggestion in the Lock Screen or…
… in the open applications list.

Conclusion

With iOS 12 Apple makes a big step forward to reduce the frictionless between users and applications opening Siri to developers. Most important, it’s not only about the voice commands, but the predictions made by Siri about when a user would use a function of your application, based on his previous behaviour.

On developer perspective, it’s very easy to implement this new functionality and Apple videos and example are very clear, that is also the reason I completely skip code example for now.

In a couple of hours you can completely upgrade your application, integrate Siri and give to your users a new way to use easily it.

--

--

darthpelo

Software Engineer & Senior iOS developer at @mobiquityinc NL. Craft Beer addict. Il caso non esiste. Il caos sì /The case does not exist. The chaos exists.