Productivity With Apple Shortcuts App & Notion: Calendar

A journey with Apple Shortcuts app

Xingxian S.
9 min readMay 3, 2024
Photo by Roman Bozhko on Unsplash

Notion has been with me since my university’s days, and I have enjoyed it till now. I have seen comments on the internet that there are other similar apps, but Notion is still my to-go application.

Apple Shortcuts App has nothing but nice to me when I want to input data into Notion and other apps like Structured. Yes, I am aware that Notion has mobile widgets, no matter what functionalities the widget comes with, nothing beats the flexibilities and high configurability Shortcuts has.

Now, what am I going to do with both Apple Shortcuts and Notion?

There’s many things that I did. One of the things is to use Notion as my Calendar.

Wait! Why can’t you use Apple Calendar or Google Calendar?

I could, but I chose not to. The calendar in Notion is simply a database but changed into a calendar view. You get to create more pages, items, contents within it. Sky’s the limit for Notion.

Is it easy to integrate both though?

Setting up

Setup a Notion Account and Setup Integration

  1. Go to Notion.so to get a free account
  2. Go to My Integration at Notion.so to create your integration
  3. Click on New Integration to create a new integration — Give it a name that relates to your project, database, or purpose.
  4. Within the integration, click on Secret to get the key — This is the API key that you will need when connecting via Notion REST API.
  5. Add this integration as a connection to the database.

Setup Apple Shortcuts

Apple Shortcuts app is, unfortunately, only meant for Apple iPhone, iPad and Mac. I prefer creating it on my iPad or Mac, but iPhone is fine too.

  1. Open the Shortcuts app and click on the “+” sign, which is located at the top right hand corner of the app.
  2. Rename the shortcut by clicking on the name, which is located at the top left hand corner after creation. You can change the icon and color as well.

You will get an empty canvas to begin with.

Database Creation

Create a Database In Notion

Create a page

Click on the “+” icon next to any existing page or section. In the screenshot, I’m clicking “+” next to the private section.

Create a database

Within the page, there’s two ways of creating the database.

  1. Hover on the most left side of the row, and click on the “+” symbol.
  2. Type in “/” and the list of commands will show (as shown in the screenshot above).

Look for “Calendar view” to create a calendar database view.

You can with link or create a new database. In this example, we create a new database.

You will need to add in some attributes for the database too. Attributes such as, event name, date, location. I have added a few other attributes to store text that are consistent and will be required in automation (As shown above). You can create your own.

In the previous step, you have created a new integration, you will need to connect it to the database.

At the top right hand corner of the desktop app, click on the meatball menu, and go all the way down to “Connections”. If it’s not already connected, click “Connect to” and select the integration.

Things you will need before you start creating a new shortcut:

Database Id

To get the database Id, view it on a web browser, and the Id is shown on the Url.

API Key

You can refresh the Secret key when there’s a need. In order to get the key, click on “Show”.

Notion Version

As of this writing, the version is 2022–06–28.

Notion API Url

As of this writing, the url is https://api.notion.com/v1/pages

I have created a database within Notion. What’s next?

Developing the Shortcut

After you have created the shortcut, as shown above. We can start developing it.

I do like to highlight on the coding practices that I have, I will always create meaningful variables that I can reuse at the later part of the code. This also helps me to troubleshoot when there’s an error.

Comment, comment, comment on your codes too. If you are in your 20s, you will regret when you reach your 30s or 40s when you relook at your codes.

Error handling and meaningful feedback messages are definitely important, especially when you run it on the home screen, unless you want to keep accessing the Shortcuts app to view the error, I’d highly recommend to add in error handling and feedback messages.

If it sounds confusing for those non programmer, just follow on the article and you will probably understand where I am coming from (hopefully).

Step 1: Create 4 variables

Remember the 4 things that mentioned above — Database Id, API Key, Notion Version, Notion API Url?

Yes!

Good, if that’s the answer.

No!

Scroll up and read it again. :)

In this example, I have created 4 variables for each of them (screenshot above).

  • DatabaseId
  • ApiKey
  • NotionVersion
  • NotionApiUrl

They are self explanatory. It’s always good to follow the best practices to name a variable.

Step 2: Prompts

Create input or selection prompts based on the attributes that you have created in the database.

What are the typical set of prompts should be asked?

  • Event name
  • Location
  • Start/End Date/Time

What other additional prompts, that you think, are required?

In this example, I think I will want to let me and/or my guests know the status of the event. It is the same as setting an event on your company’s calendar.

  • Calendar status
  • Is this an all-day event?
  • Business type

Of course, you might not require some of the prompts.

Let’s build the prompts.

In the above screenshot, I start asking for the name of the event, and location. Once that’s done, a selection prompt to ask for the status. Each selection will have its own set of actions that you can define.

In my example, I only added a text, followed by setting the variable. If you only have one simple action, like “text”, you can move “set variable” out to capture the result instead.

As you can see, my example, I’ve also included “Canceled”. This will be used for automating deleting of event from Google Calendar. You can leave this option out if you aren’t automating adding of events to Google Calendar. In additionally, this option is, typically, meant for updating of calendar event, hence, if your shortcut is only for creation, you can remove it.

Some might argue that there’s an option Is_trash, which is part of the JSON output when Notion API is called. Yes, there is this option, but once it’s deleted, some automation application will not be able to view the page. To avoid the risk of guessing, I would prefer to add this additional status.

The next prompt will be to give yourself a selection of calendar type. In this example, if you have multiple businesses, list them down. Of course, you can add in an option to “apply to all calendar”.

Once you have selected the business type, you might want to ask yourself, if this event is an all-day event.

If yes, then you might want to just ask for one date (without time), and set end date as start date. End date cannot be empty in the variable, even a null date (typically, 1900–01–01) will not work. Dates will be required to format to ISO8601 before passing into Notion.

If no, then you will have to ask for both start and end date/time. You might want to add in a check to ensure that the end date/time is not smaller than start date/time. This is to ensure to avoid letting yourself making any mistake.

Step 3: Connecting to Notion API

Once you have built your prompts, it’s time to call Notion API.

Create a JSON and set it to a variable. Notice the usage of the variables above, which were defined at the top. Shortcuts App does provide “magic variable”, where it will give you variables with name that defaulted to the action (e.g. the variable name for “Text” is “Text”). You can use that, and probably end up having the same variable name.

Next, use “Get Contents Of…” to call the Notion API Url. Set the “method” to POST, with the following “headers”:

  1. Authorization: Bearer<API Key>
  2. Notion-Version: Notion version number
  3. Content-Type: application/json

You notice that “content-type” is hardcoded, since, it presumed that the content-type will not change in years to come.

Set the “Request Body” to FILE, and select the JSON text as the “File”.

Step 4: Add in meaningful feedback messages and do error handling

Once you have your app done up, add in the necessary meaningful feedback message and do error handling.

I have added basic error handling and feedback messages. When there’s error, it will show “Error adding calendar event” with the output JSON given by the Notion API.

If it successfully added, it will show that the calendar event has been successfully added. In this example, I have also asked myself if I would want this event to be added to the Structured App, which I won’t cover it here.

Conclusion

It’s fairly simple to create a shortcut using Apple Shortcuts App, you have to understand the limitations that it has. Even if other services have API, there’d be a limitation imposed by their API also.

Anyway, I highly enjoyed creating shortcuts using the Apple Shortcuts app. This might not be for everyone, but I hope those who are interested to start building your shortcut can find this tutorial useful.

Those who are curious;

Why would you want to create this shortcut then?

I created this to help adding the same calendar event into three different calendars, Notion Calendar, Google Calendar and Structured.

Why do you even need three calendars?

Notion calendar allows me to add in detailed information and attached multiple files. I usually use Structured App on all my devices. Google calendar is there mainly to share calendar events with others.

Then, which is the true source of data?

Notion calendar will be the true source of data. I use Make.com to automate event creation in Google Calendar once new calendar events have been added or updated.

Do contact me if you have any questions.

--

--

Xingxian S.
Xingxian S.

No responses yet