DEV Community

semisenioritis
semisenioritis

Posted on

How can I use the Notion API to automate Notion? API

So, I've been trying to build my own task management system, and I've finally settled down at notion.

From what I understand of the Notion API, when code (that I have written) is triggered, the code goes and connects the "Integration" to the Notion "Database" and then proceeds to execute whatever code is in the file.

But what confuses me is since I want to automate stuff inside Notion itself, specifically, get the code to read a column from the database and add a specific tag to another column, I don't understand how I'm supposed to get the code to trigger from inside notion. I preferably don't want the code to keep running 24/7 in my laptop so that changes in the database can be detected, but at this point I have no idea how to trigger any code at all.

Any ideas/guides?

Top comments (3)

Collapse
 
lgaud profile image
Lisa

You're right that you need something to trigger it if you're using the API. The email example in Notion's docs checks for changes every 5s while the code is running, as an example. There are various ways to run code on a timer in the cloud if that's an avenue you want to pursue (AWS Lambda, Azure Functions, etc).

But from your basic description, it's likely possible to achieve what you're looking for within Notion using Formulas (perhaps also Relations and Rollups). There's lots of task management templates out there that don't use the API.

Collapse
 
semisenioritis profile image
semisenioritis

Thanks!

Another follow-up question, is there some way to assign a selector column/ tag column in notion based on another column?
What im trying to do is take one column as an input and if that column is checked, assign a done selector to the row.

The issue I ran into while using the built-in if function was that both outputs of the if are always strings and nothing else. Any workaround for this?

Collapse
 
lgaud profile image
Lisa

You can use true and false without quotes as outputs for an if and it will show as a checkbox.

Neon image

Next.js applications: Set up a Neon project in seconds

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Get started →

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay