When Apple released iOS 12 in September, it replaced the Workflows app with a new feature called Siri Shortcuts.
Siri Shortcuts is billed as a way to let iPhone users quickly perform everyday tasks by asking Siri.
It also learns your routines across your apps and suggests an easy way to perform common tasks, while Siri Shortcuts exposes options for developers to create more advanced actions.
Specifically, Siri Shortcuts supports reading from web APIs.
This is where control system engineer Carl Sandrock began his investigation into whether it would be possible to automatically send his wife an SMS with an estimated Gautrain time of arrival by issuing a command to Siri.
To probe how the Gautrain mobile app gets the data it uses for trip planning, Sandrock used a tool called mitmproxy.
The “Man In The Middle Proxy” allows you to inspect network traffic flowing from your device to the Internet.
In analysing the traffic, Sandrock discovered that the API uses WhereIsMyTransport.com — a South African startup which has integrated data from Gautrain with other public transport systems.
At the start of 2018, Gautrain revamped its website and mobile app to offer commuters a host of new features. This included a trip planning tool.
The trip planning tool was enabled by WhereIsMyTransport, which worked with the teams at the Gautrain Management Agency and Bombela Concession Company.
The power of automation engines
Sandrock was then able to create three actions using the Gautrain API and Siri Shortcuts:
- A “Going home” action which queries the API for the next train he is likely to catch, estimates his time of arrival, and sends his wife an SMS with the information.
- A “Morning train” action which figures out what train he needs to catch to get to his first appointment.
- A “Next train” action which tells him when the next train leaves from a particular station.
Details on the API hooks Sandrock used are published on his blog.
While third-party automation engines such as Stringify do offer integration into Google’s traffic and navigation systems in Google Maps, these do not always provide the data you need to build actions such as the ones described above.
Though voice assistants like Siri and Google Assistant are becoming more advanced with every iteration, South Africans often don’t get all the feature sets.
Even if integration between third-parties and voice assistants was more readily available in South Africa, natural language processors are still going to need a bit of help to understand what you mean when issuing commands.
However, as long as the service you’re trying to use exposes a decent web API and your device has a tool that can build workflows with those APIs, it is possible to build automated actions for your smartphone.
To use Siri Shortcuts on iOS, you must install the app from the App Store.
Sandrock has published his shortcut on iCloud, allowing other iOS users to click on the link and import it directly.