<- Back

Resrobot Apple Shortcuts

2023-07-14

During my vacation, I had the opportunity to delve into Apple Shortcuts and discover its potential for enhancing my daily routines. In particular, I found a practical application for Apple Shortcuts in obtaining transit departure information from a specific stop as soon as I leave an area. In this blog post, I’ll provide a brief overview of Apple Shortcuts and explain how I used it, alongside the “ResRobot API” from trafiklab.se, to solve this problem efficiently. Additionally, I’ll share the two shortcuts I created for this purpose and provide the necessary resources to implement them.

What is Apple Shortcuts?
Apple Shortcuts is a powerful automation app available across the complete Apple ecosystem, including iOS devices, iPadOS, and macOS. It allows users to create custom workflows by connecting different actions across various apps and services. These workflows, known as shortcuts, can be triggered manually or automatically to streamline repetitive tasks and simplify complex actions.

Screenshot of the Apple shortcuts application, containing 3 actions tied together.

Apple Shortcuts are made for non programmers and the interface is contained by drag and droppable actions.

One of the challenges I often faced was keeping track of transit departure times from a specific stop, such as knowing when the next bus departs as soon as I leave work. This information is crucial for planning my commute and ensuring I catch the appropriate transit at the right time.

Apple Shortcuts and ResRobot API
To address this problem, I turned to Apple Shortcuts and leveraged the ResRobot API from trafiklab.se, a valuable resource for transit information. ResRobot covers all public transportation in Sweden, providing comprehensive data across the country’s transit network. By combining Apple Shortcuts with ResRobot, I was able to create a seamless workflow that provided me with real-time departure updates for my desired stop, regardless of the location in Sweden.

The Shortcuts

Helper Shortcut: Finding the Stop ID
The first shortcut I created is a helper shortcut designed to help users identify the unique ID of the stop they want to monitor. By inputting relevant information, such as the stop name or location, this shortcut interacts with the ResRobot API to retrieve the corresponding stop ID.

Departure Updates Shortcut: Getting Upcoming Departures
The second shortcut is the core component that retrieves upcoming departure information based on the stop ID obtained from the helper shortcut. It communicates with the ResRobot API and fetches the latest transit departure data, providing you with timely updates on when the next bus, train, or other modes of transportation will depart.

A screenshot of the notification, saying that bus line 4 arrives in 6min, 14min and 23min

A notification sent by the Departure Updates Shortcut.

To implement these shortcuts, you’ll need to acquire an API key from trafiklab.se, which is freely available. Once you have the API key, you can download and install the shortcuts using the provided iCloud links:

Automation Possibilities
One of the remarkable features of Apple Shortcuts is its ability to connect with various automation triggers. This means you can integrate shortcuts with different types of actions, such as when you leave a specific area, arrive at a location, or even at a specific time of day. By exploring the automation options within the Shortcuts app, you can customize your workflows to perfectly suit your needs and optimize your daily routines.

By harnessing the power of Apple Shortcuts and integrating the ResRobot API, I was able to streamline the process of obtaining transit departure updates from a specific stop. Whether you’re leaving work, heading home, or navigating through any other routine transit scenario, these shortcuts can save you time and provide you with the information you need at your fingertips. Try them out and experience the convenience of real-time transit updates tailored to your needs, anywhere in Sweden.