{"id":289976,"date":"2018-12-31T10:30:23","date_gmt":"2018-12-31T08:30:23","guid":{"rendered":"https:\/\/mybroadband.co.za\/news\/?p=289976"},"modified":"2018-12-31T10:31:39","modified_gmt":"2018-12-31T08:31:39","slug":"hacking-the-gautrain-api-to-use-ios-siri-shortcuts","status":"publish","type":"post","link":"https:\/\/mybroadband.co.za\/news\/software\/289976-hacking-the-gautrain-api-to-use-ios-siri-shortcuts.html","title":{"rendered":"Hacking the Gautrain API to use iOS Siri Shortcuts"},"content":{"rendered":"<p>When Apple <a href=\"https:\/\/mybroadband.co.za\/news\/software\/275923-apple-releases-ios-12-all-the-details.html\"><strong>released iOS 12<\/strong><\/a> in September, it replaced the Workflows app with a new feature called Siri Shortcuts.<\/p>\n<p>Siri Shortcuts is <strong><a href=\"https:\/\/support.apple.com\/en-us\/HT209055\" target=\"_blank\" rel=\"noopener\">billed<\/a><\/strong> as a way to let iPhone users quickly perform everyday tasks by asking Siri.<\/p>\n<p>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.<\/p>\n<p>Specifically, Siri Shortcuts supports reading from web APIs.<\/p>\n<p>This is where control system engineer Carl Sandrock began his <strong><a href=\"http:\/\/negfeedback.blogspot.com\/2018\/09\/gautrain-app-reverse-engineering.html\" target=\"_blank\" rel=\"noopener\">investigation<\/a><\/strong> 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.<\/p>\n<h3 class=\"my-4\">Gautrain integration<\/h3>\n<p>To probe how the Gautrain mobile app gets the data it uses for trip planning, Sandrock used a tool called mitmproxy.<\/p>\n<p>The \u201cMan In The Middle Proxy\u201d allows you to inspect network traffic flowing from your device to the Internet.<\/p>\n<p>In analysing the traffic, Sandrock discovered that the API uses WhereIsMyTransport.com \u2014\u00a0a South African startup which has integrated data from Gautrain with other public transport systems.<\/p>\n<p>At the start of 2018, <a href=\"https:\/\/mybroadband.co.za\/news\/technology\/247221-gautrain-launches-new-website-and-mobile-app.html\"><strong>Gautrain revamped<\/strong><\/a> its website and mobile app to offer commuters a host of new features. This included\u00a0a trip planning tool.<\/p>\n<p>The trip planning tool was enabled by <strong><a href=\"https:\/\/www.whereismytransport.com\/case-study\/integrating-data-efficient-communication-south-africas-rapid-rail\/\" target=\"_blank\" rel=\"noopener\">WhereIsMyTransport<\/a><\/strong>, which worked with the teams at the Gautrain Management Agency and Bombela Concession Company.<\/p>\n<h3 class=\"my-4\">The power of automation engines<\/h3>\n<p>Sandrock was then able to create three actions using the Gautrain API and Siri Shortcuts:<\/p>\n<ul>\n<li>A \u201cGoing home\u201d 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.<\/li>\n<li>A \u201cMorning train\u201d action which figures out what train he needs to catch to get to his first appointment.<\/li>\n<li>A \u201cNext train\u201d action which tells him when the next train leaves from a particular station.<\/li>\n<\/ul>\n<p>Details on the API hooks Sandrock used are published on his <strong><a href=\"http:\/\/negfeedback.blogspot.com\/2018\/09\/gautrain-app-reverse-engineering.html\" target=\"_blank\" rel=\"noopener\">blog<\/a><\/strong>.<\/p>\n<p>While third-party automation engines such as Stringify do offer integration into Google\u2019s 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.<\/p>\n<p>For an automation platform that has the benefit of being able to consume the Gautrain API directly, Android users do have the option of tools such as <strong><a href=\"https:\/\/play.google.com\/store\/apps\/details?id=net.dinglisch.android.taskerm\" target=\"_blank\" rel=\"noopener\">Tasker<\/a><\/strong> (with <strong><a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.freehaha.restask\" target=\"_blank\" rel=\"noopener\">RESTask<\/a><\/strong>), <strong><a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.llamalab.automate&amp;rdid=com.llamalab.automate\" target=\"_blank\" rel=\"noopener\">Automate<\/a><\/strong>, and <strong><a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.arlosoft.macrodroid\" target=\"_blank\" rel=\"noopener\">MacroDroid<\/a><\/strong>.<\/p>\n<h3 class=\"my-4\">Voice assistants<\/h3>\n<p>Though voice assistants like Siri and Google Assistant are becoming more advanced with every iteration, South Africans often don\u2019t get all the feature sets.<\/p>\n<p>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.<\/p>\n<p>However, as long as the service you\u2019re 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.<\/p>\n<p>To use Siri Shortcuts on iOS, you must install the app from the <strong><a href=\"https:\/\/support.apple.com\/en-za\/HT208309\" target=\"_blank\" rel=\"noopener\">App Store<\/a><\/strong>.<\/p>\n<p>Sandrock has published his shortcut on <strong><a href=\"https:\/\/www.icloud.com\/shortcuts\/62d092ccdb584868ad58a9d3943eb7fb\" target=\"_blank\" rel=\"noopener\">iCloud<\/a><\/strong>, allowing other iOS users to click on the link and import it directly.<\/p>\n<h3 class=\"my-4\">Now read: <a href=\"https:\/\/mybroadband.co.za\/news\/smartphones\/282723-apple-releases-ios-12-1-the-details.html\">Apple releases iOS 12.1 \u2013 The details<\/a><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>When Apple released iOS 12 in September, it replaced the Workflows app with a new feature called Siri Shortcuts.<\/p>\n","protected":false},"author":15,"featured_media":236822,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_sma_x_autopost_status":"idle","_sma_x_autopost_error":"","_sma_x_post_id":"","_sma_facebook_post_id":"","_sma_instagram_post_id":"","_sma_threads_post_id":"","_sma_x_attempts":0,"footnotes":""},"categories":[16],"tags":[56350,8231,35,51351,2916,56352,56354],"class_list":["post-289976","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-carl-sandrock","tag-gautrain","tag-headline","tag-ios-12","tag-siri","tag-siri-shortcuts","tag-whereismytransport"],"_links":{"self":[{"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/posts\/289976"}],"collection":[{"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/comments?post=289976"}],"version-history":[{"count":1,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/posts\/289976\/revisions"}],"predecessor-version":[{"id":290464,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/posts\/289976\/revisions\/290464"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/media\/236822"}],"wp:attachment":[{"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/media?parent=289976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/categories?post=289976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/tags?post=289976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}