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.