Skip to content

A basic script using the Notion-API to make recurring tasks work in notion workspace.

Notifications You must be signed in to change notification settings

danhenrik/Notion-RepetitiveTask

Repository files navigation

Notion Repetitive Task

That's a basic script made to automate recurring tasks in notion (one of it's weakness). I know that there's a lot of things to improve in this simple script, but i did this for myself to solve one of my daily struggles with notion, when i 'finished' i thought, why not help some people that maybe having the same issue, even though there's limitations, so here we are. All this script does is change the repetitive task date to the next occurrency creating an alert if the task wasn't done. Hope this script help you with your productivity/organization, feel free to start discussions, suggest improvements or improve the app by yourself. 😃

For the script to work you will need to:

Assuming that you already have node installed

1 - Create a private Notion integration 2 - Clone the repository into your computer 3 - Create a .env file in the application directory 4 - Fill the .env file with the following variables

TOKEN = <Your-integration-token>
DATABASE_URL = <Your-notion-database-URL>
TITLE_FIELD = <Name-field-in-notion>
DATE_FIELD = <Date-field-in-notion>
CHECKBOX_FIELD = <Done-checkbox-field-in-notion>
REPETITIVE_FIELD = <Repetitive-field-in-notion>
TZ = <Your-timezone>

5 - Run npm install

npm install

6 - Then run npm start

npm start

Everything should be working at this moment, if don't, make sure you have put the right variables at the .env and your database is ok with the requirements and shared with your integration.

Now you're probably wondering, alright, i'll have to run the script every day? Would be better to do this by hand, relax, i got you, i'm currently working on how to automate this so you don't need to do this process but for the time you'll have to run the script for the first time and put the generated .bat file (if you're on windows) in your task scheduler, in Util Links section there's a link to do that in windows, i suggest you to schedule a task with triggers at logon and daily arround 3:00 AM. (I'm currently trying to figure my way arround this and i'm open for suggestions)

How to create a notion integration

In your notion workspace click: Settings & Members > Integrations > Develop your own integrations > New Integration Then you put the name you want for your integration and click submit, the integration will be created and you will need the secret, so copy it and paste on your .env file.

How to use the notion template

Here you can see a example and if you want you can clone it into you notion workspace just by clicking duplicate and selecting the workspace you want. In case you're using the template the .env file should look like this:

TOKEN = <Your-integration-token>
DATABASE_URL = <Your-notion-database-URL>
TITLE_FIELD = Name
DATE_FIELD = Date
CHECKBOX_FIELD = Done
REPETITIVE_FIELD = Repetitive
TZ = <Your-timezone>

Sharing database with integration

To share a specific database with notion you gotta click share at the top right corner, then Invite and your integration should be listed there as a suggestion.

Requirements to work

  • .env
    • Token: The secret key generated in your integration creation
    • Database URL: URL generated by clicking share on the database (not the workspace), then copy link, or in the workspace visualization click the tree dots on the top right corner of the database you want to share and click copy link.
    • Name field: Title field; -- (can be seen in tabke vizualization)
    • Date field: Date field; -- Used to organize the tasks by day, the one that's gonna be modified to keep the tasks appearing in it's occurrency.
    • Done field: Check box field; -- Propertie that you check once you finish the task, the one that's gonna be unchecked so the task appears in undone tasks filter.
    • Repetitive field: Select field; -- Select with the options ["Daily","Weekly","Monthly","Every other day"]
    • TZ: The time zone you're in, will be used in the re-eschedule of tasks
  • Dependencies installed
  • Database shared with integration

Util information:

- Time zone list - Notion template - Your notion integrations dashboard - Scheduke Task in Windows