You see something interesting, you should learn about that. That is what I grew up listening to. That is why I explore various things that I come across.
Recently, I started using Notion a tool that is praised by people around the globe. The number of features that Notion offers is incredible. And a few months ago, I saw that Notion released a public API that we can interact with. So, the developer in me thought of exploring it. I started with a very very small project.
I took advantage of Shortcuts App and Personal Automation available in iPhone and iPad for this project.
The project is simple, every time, I plug my device into a charger, it writes a new record into Notion database with current battery level and time. Whenever, I unplug it, it will add battery level into another column in the same row along with the timestamp. Sounds easy right?
Notion Setup.
First, let’s get into Battery info database.
Step 1: You will need to create a database in your workspace. If you would like to use the shortcuts that I created as it is, you can duplicate the Notion Database template from here. Once the database is created, click on share icon and copy the link to the database and place it in a text editor. The database ID is the one that comes after “/” and ends before “?v”. Copy the value and store it somewhere handy.
Step 2: You need to create an internal integration from this page. Store the Internal Integration Token somewhere safe.
Step 3: Go to the database you created or duplicated earlier and add the connection you created in above step to this database as shown below.

iPhone/iPad Setup
I have created two shortcuts for this Automation to work. One is used when a charger is connected and the other when charger is disconnected. You can duplicate the below shortcuts and add the values of database ID and the integration token in the shortcuts.
Once I have the shortcuts setup, I used the Personal automation option on my devices to run these Automation when charger is connected/disconnected. One thing you need to do when setting up Personal Automation is turning off “Ask before Running”. I find that quite annoying. An automation is something I would want to run automatically not something that will need my attention to.
Easy peasy super easy project that you can work on a Sunday if you are interested in exploring Notion API. I am exploring a lot of different APIs that I can integrate my iPhone to. If I succeed, you will know here.
Thanks for reading, see you next time.