├── README.md ├── ToDoIst to Notion - Public.py └── ToDoIst to Notion.mp4 /README.md: -------------------------------------------------------------------------------- 1 | # ToDoIst-to-Notion 2 | Bring ToDoIst tasks over to Notion Database 3 | 4 | Edit the information at the top of the python file with your personal information. There is a mp4 video that shows how the script may be used. 5 | -------------------------------------------------------------------------------- /ToDoIst to Notion - Public.py: -------------------------------------------------------------------------------- 1 | import todoist 2 | 3 | ##You need the title of your Notion Dashboard to be "Task" 4 | ##You need a date column of your Notion Dashboard to be "Date" 5 | ##You need a multi-select column of your Notion Dashboard to be "Dashboard" and should have already created the "ToDoIst" option on Notion 6 | ##### ALL OF THE VALUES YOU PASTE HERE SHOULD BE IN STRINGS 7 | TODOIST_API_KEY = #copy and paste the api key 8 | TODOIST_label_id = #when you're on the website and under the specific label, you'll be able to get the id by inspect element and finding the number 9 | NOTION_API_KEY = # "secret_somneklhjslkdgjsdljfg" or something like that 10 | database_id = #get the mess of numbers and letters before the "?" on your dashboard URL and then split it into 8-4-4-4-12 characters between each dash 11 | 12 | 13 | 14 | api = todoist.TodoistAPI(TODOIST_API_KEY) 15 | api.sync() 16 | 17 | import requests 18 | resultList=requests.get( 19 | "https://api.todoist.com/rest/v1/tasks", 20 | params={ 21 | "label_id": TODOIST_label_id 22 | }, 23 | headers={ 24 | "Authorization": "Bearer %s" % TODOIST_API_KEY 25 | }).json() 26 | 27 | 28 | taskData = [] 29 | 30 | import os 31 | from notion_client import Client 32 | from pprint import pprint 33 | from datetime import datetime 34 | 35 | os.environ['NOTION_TOKEN'] = NOTION_API_KEY 36 | notion = Client(auth=os.environ["NOTION_TOKEN"]) 37 | 38 | for result in resultList: 39 | print(result) 40 | print("\n") 41 | 42 | taskName = result['content'] 43 | dueDate = result['due']['date'] 44 | 45 | #Enter the task into Notion 46 | my_page = notion.pages.create( 47 | **{ 48 | "parent": { 49 | "database_id": database_id 50 | }, 51 | "properties": { 52 | 'Task': { 53 | "type": 'title', 54 | "title": [ 55 | { 56 | "type": 'text', 57 | "text": { 58 | "content": taskName, 59 | }, 60 | }, 61 | ], 62 | }, 63 | 'Date': { 64 | "type": 'date', 65 | 'date': { 66 | 'start': dueDate, 67 | 'end': None, 68 | } 69 | }, 70 | 'Dashboard': { 71 | "type": 'multi_select', 72 | 'multi_select': [{ 73 | "name": "ToDoIst" 74 | }], 75 | }, 76 | }, 77 | }, 78 | ) 79 | 80 | #Delete the task from ToDoIst (the api stuff is defined in the first 3 lines of the program) 81 | 82 | item = api.items.get_by_id(result['id']) 83 | item.delete() 84 | api.commit() 85 | 86 | 87 | -------------------------------------------------------------------------------- /ToDoIst to Notion.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akarri2001/ToDoIst-to-Notion/6013e91d3a2fa2ab5b7c9b3e483f477c8c181f3a/ToDoIst to Notion.mp4 --------------------------------------------------------------------------------