LeanneStoDomingo / recurtion

A bot that adds recurring tasks to Notion using the official API
https://recurtion.notion.site/Recurtion-Instructions-237146fda1174a9eb6d21e5724a668b4
MIT License
3 stars 1 forks source link

recurtion

A bot that adds recurring tasks to Notion using the official API

Instructions can also be found here

How to Update to Latest Version \ Bugs \ Set Up Notion \ Set Up Integration

How it Works / How to Use \ Limitations \ Upcoming Improvements / Features / Ideas

How to Update to Latest Version

At this time, there is no way to automatically update a forked repl

Bugs

Set Up Notion

  1. Create a table database for the integration to work with

    • Option 1: duplicate this template
    • Option 2: create your own database that includes these properties:
      • Checkbox - to indicate if a task has been completed
      • Date - to show when the task should be completed
      • Select or Text - the interval at which the task repeats
        • If it's a Select property, you can include as many options as you like
        • Must include an option for the interval to be invalid (see the template for an example)
    • You can change the names of the properties (remember them for a later step)
    • You can also add as many addition properties as you like since they won't affect how the integration works
  2. Go to your Notion Integrations

  3. Click on + New integration

  4. Name the integration, point it to the correct workspace, and click Submit

  5. You can access the Internal Integration Token by clicking Show and then Copy (you need this for a later step)

  6. Go back to the database and click on Share in the upper right-hand corner

  7. Invite the integration you just made by clicking on Invite and then the name that you wrote in Step 4

Set Up Integration

These steps are loosely based on An Idiot's Guide to hosting discord bots

Option 1 (free): Replit

  1. Create a replit account

  2. Open the recurtion repl

  3. Fork the repl fork button

  4. The forked repl should open. Go to the Secrets tab on the left hand side

  5. Click on Open raw editor\ raw editor button

  6. Copy the code snippet below and paste into the editor

    {
    "NOTION_TOKEN": "your-notion-token-here",
    "CHECKBOX": "Done",
    "DUE_DATE": "Due Date",
    "RECUR_INTERVAL": "Recur Interval (select)",
    "INVALID": "Invalid format",
    "ADDRESS": "https://your-own-address-here.repl.co"
    }

    raw editor

  7. Replace each value with your own values and save

    • NOTION_TOKEN : get from Step 5 of Set Up Notion
    • CHECKBOX, DUE_DATE, RECUR_INTERVAL, INVALID : get from Step 1 of Set Up Notion
    • ADDRESS :
      • option 1 : https://{name-of-repl}.{your-username}.repl.co
      • example: https://recurtion.leannestodoming.repl.co
      • option 2 : when you run your repl, a small browser should appear with the url on top repl url
  8. Click on the Run button at the top of the screen \ run button

  9. (Optional) If you want an even more reliable way to keep the program running 24/7, follow these instructions

  10. Enjoy recurring tasks in Notion!

Option 2 (advanced): self-hosted/VPS

To preform this option, you should be comfortable with using the command line interface. You should also have npm installed on the server you are using. If you don't have npm installed or you aren't sure, follow these instructions.

  1. Clone this repository onto the server

    git clone https://github.com/LeanneStoDomingo/recurtion.git
  2. Go into the new folder

    cd recurtion
  3. Create the environment variables file (these instructions use nano but you can choose any cli text editor that you would like)

    nano .env
  4. Type the code snippet from below into the file

    NOTION_TOKEN=your-notion-token-here
    CHECKBOX="Done"
    DUE_DATE="Due Date"
    RECUR_INTERVAL="Recur Interval (select)"
    INVALID="Invalid format"
    PORT=3000
    ADDRESS=http://localhost:3000
  5. Replace each value with your own values

  6. Save and exit the text editor by pressing ctrl+x

    • nano will ask if you want to save the file, so press y
    • it will then ask if you want to save it in the same file, so press enter
  7. (Optional but recommended. Skip to Step 10 if you don't want to do these optional steps) \ Open index.js

    nano index.js
  8. Delete everything after the // web server comment

    // web server
    const PORT = process.env.PORT || 3000;
    
    const server = http.createServer((req, res) => {
        res.writeHead(200);
        res.end('ok');
    });
    server.listen(PORT);
    
    setInterval(() => {
        http.get(process.env.ADDRESS);
        console.log('pinging server...');
    }, 1000 * 60 * 4);      // pings every 4 minutes
    

    ^ all of this should be deleted

  9. Save and exit the text editor

  10. Initialize node

    npm install
  11. Start the program

    node index.js

    or

    npm start
  12. Enjoy recurring tasks in Notion!

How it Works / How to Use

Limitations

Upcoming Improvements / Features / Ideas