How I Built a Daily Habit Counter to Exercise: Notion API and Postman

The wonderful world of home fitness. Like many of us during these recent years of COVID lockdowns, I decided to explore indoor workouts—which, for me, came in the form of a pull-up bar. The idea that I could get healthy without ever having to leave the comfort of my own apartment made the purchase an obvious choice.

When I first got my pull-up bar, I felt like I had stumbled upon some kind of “life hack.” I could get fit by simply jumping up and doing a quick set of reps throughout the day without really having to think about it. And it worked! But only for a brief period of time. Soon enough, my initial excitement faded, and before I knew it, I wasn’t using the bar at all.

Slacking? Try tracking

If you’re anything like me, items in your everyday environment can quickly start to feel like background “noise” that you stop noticing altogether. This is what happened with said pull-up bar and those daily reps.

Despite all of my conscious efforts to use it more consistently, I kept finding that my use of the pull-up bar would dwindle over time. Soon enough, days and then weeks would go by where I hadn’t even touched it.

As it turns out, this is a very common problem for people trying to “install” new habits and behaviors into their life. One strategy for preventing habits from falling off is by monitoring your activity. By tracking how often you actually do the desired behavior, you can gain valuable insight into your usage patterns.

This all got me thinking: maybe I could use an approach for tracking to motivate myself to use that pull-up bar more often.

Use Postman and Notion to stay in motion

I’m a huge fan of Notion. I use it every day and pretty much have my entire life organized in a series of Notion boards, databases, and to-do lists. I knew they had an API available, and I had been itching to work with it. Now I had a useful project in mind: I would combine Notion’s API with Postman to help me get healthier.

The result? I created a Postman Collection and monitor to track how much I use my pull-up bar. Here’s a quick video walk-through of how the collection works:

If you’d like to use this collection and Notion template, follow these steps to get up and running:

Step 1. Fork this Postman Collection and duplicate this Notion page into your own workspaces. You can learn how to duplicate a notion page here.

Step 2. Set up a Notion Integration and update the collection variables `API_TOKEN` value with your new Integration secret.

Step 3. Click on Share in the top right corner of your newly duplicated Notion page. Give your integration edit access to the page:

Once you have added the integration, click the Copy link button to get your Page ID. The Page ID is the alphanumeric string at the end of the URL before the query parameters. Update the collection’s `COUNTER_PAGE_ID` variable with this value.

Step 4. Test the collection out by clicking the Increment daily counter up button in Notion pages Counter dropdown toggle a couple of times. This will give us some dummy data to test.

Step 5. Send each request in the Postman Collection. Your total count should appear in the database:

Step 6. Create a daily monitor for this collection and set it to run every day around 5am.  Sometimes monitors run in a time zone that is different from yours, so if you set your monitor to run every day near midnight, you may occasionally have the wrong date logged to your database. The code that handles this is in the pre-request script in the request titled “Step 3. Write total count to DB and reset Counter.”

Step 7. You’re ready to start tracking! I’ve left comments in the collection’s Requests, Pre-request Scripts, Tests Scripts, and Documentation tabs that go into more detail about what is happening during each step of the process. I recommend downloading the Notion app on your phone to make it even easier to increment this counter throughout the day.

The final count

So, did this app and approach help me use my pull-up bar more and get in shape, or was it all an elaborate form of procrastination? The answer to that question is yes; it helped motivate me to exercise more regularly throughout my day.

I went from using my pull-up bar once or twice every couple of days, to using it three to five times a day on average! What’s even better is that by having my habit represented visually, I was able to quickly notice when I was starting to lose momentum after not using it for a day or two—which caused me to course correct. Ultimately, it has helped me turn pull-ups into a long-term, consistent practice.

So if there is a habit or daily practice that you’ve always had trouble forming, maybe this Postman Collection and Notion template will work for you too. Good luck—and let us know how it goes in the comments below!


What do you think about this topic? Tell us in a comment below.

Comment

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 thought on “How I Built a Daily Habit Counter to Exercise: Notion API and Postman

  • How many pull ups can you do now, Michael?