Notion - Reoccurring Events
@bennettyardley
code:
data:privatelast updated:2 years ago
@bennettyardley/
Notion - Reoccurring Events

Notice

This was originally designed for tasks by Luke Docksteader (https://docksteaderluke.com). I remixed it a little to fit my needs (automatically adding reoccurring events not just tasks that are completed), so if you are feeling generous, donate to Luke at: https://gum.co/notion-recurring-tasks

What To Expect From This Workflow

This workflow starts by using Notion's API to fetch a list of tasks from your target Notion database that are:

  • Section Needs Update

Once this list has been fetched, the workflow then modifies each of the tasks in the following manner:

  • Section Needs Update

Noteworthy

  • Both start and end times are updated in a tasks date field
  • Times are ignored and left as-is
  • Tasks that have an interval in Notion that is not in the list of intervals in this workflow are ignored. This allows you to specify complex recurring intervals in Notion that you want ignored by (and are not currently supported by) this workflow so that you can change them manually (e.g. "every 4th Friday").

What You Will Need Before You Begin

  • A Notion database with the following properties:
    • A Checkbox property used to denote a task's completed state
    • A Date property used to denote a task's due date
    • A Select property used to denote a tasks recurring interval
    • Section Needs Update

Instructions

1. Setup A Notion Integration

  • Create a new Notion Internal Integration, give it a name, and select the desired workspace. https://www.notion.so/my-integrations
  • Copy the Internal Integration Token and keep it ready for use in step 4. Do not share this token with anybody!

2. Prepare Your Notion Database

  • In Notion, share the target database with the new integration you just setup. Open the target database as a full page then click Share -> Add people, emails, groups, or integrations -> Select an integration -> Invite
  • Get your task database ID and keep it ready for use in step 4.

Where can I find my database's ID?

Open the database as a full page in Notion. Use the Share menu to Copy link. Now paste the link in your text editor so you can take a closer look. The URL uses the following format:
https://www.notion.so/{workspace_name}/{database_id}?v={view_id}
Find the part that corresponds to {database_id} in the URL you pasted. It is a 36 character long string. This value is your database ID. Please note that the {workspace_name} may not appear in the URL you pasted and that the {database_id} will always be the string after the last slash / and before the question mark ?.

3. Copy This Workflow Into Your Own Pipedream Account

  • If you don't already have one, sign up for a free Pipedream account here: https://pipedream.com
  • Click the big blue "Copy" button at the top-right of this screen. This will transfer you to the WORKFLOW tab so be sure to switch back to the README tab (near the top-left of this panel) to finish reading these instructions!

4. Assign Params In the Pipedream Workflow

  • Assign the Notion API Token param in Workflow -> steps.config -> params using the Internal Integration Token you copied in step 1.
  • Assign the Task Database ID param in Workflow -> steps.config -> params using the database ID you copied in step 2.
  • Assign the Completed, Due Date, and Interval property names to their respective params in Workflow -> steps.config -> params as they are named (exactly) in your Notion database.
  • Optionally, define the recurring intervals used in your Notion database's Interval property using the key/value pairs in the Intervals param in Workflow -> steps.config -> params. Leaving this property blank will default to the following intervals:
Daily : {{[1, 'days']}}
Weekly : {{[1, 'weeks']}}
Biweekly : {{[2, 'weeks']}}
Monthly : {{[1, 'months']}}
Quarterly : {{[1, 'quarters']}}
Semi-Annually : {{[6, 'months']}}
Annually : {{[1, 'years']}}

To define your own intervals, use the same format you see above (key to the left of the colon, and value to the right of the colon). For each interval specified, the key must match (exactly) an option from your Notion database's interval select property.
Important: Any interval in Notion that isn't specified in this list will be ignored and its corresponding task will be skipped.

  • Save and Deploy the workflow

5. Run/Schedule the Workflow

In Workflow -> steps.trigger set the schedule for how often the workflow should run. I currently have mine set to run once per day at 4:00am (Cron Expression: 0 4 * * *). For help with generating Cron expressions try: https://crontab.cronhub.io/

You can also manually run the workflow by clicking the "Run Now" button.

Disclaimer

This workflow is currently in beta and the API it uses is also in beta. As such, it is entirely feasible that the API, on which this depends, could change thereby breaking this workflow, itself.

By using this workflow, you understand the risks and assume all responsibility for any data changes/loss that may result.

License

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.