Turns every new row in your Notion planning database into a Todoist task, and never sends the same row twice.
UsesNotion
Todoist
Send planned work from Notion to Todoist
Every hour, your Notion planning database is checked for rows that have not yet been sent across, and a Todoist task is created for each one with the row's title as the task text and its due date carried over. The task's id is then written back to the row, which is how the same row is never sent twice.
You end up with a Todoist task for every planned row, in the project you choose or in your Inbox, with no duplicates. If the write back to Notion ever fails, the run stops on the spot and tells you which row, so at worst one task is created twice rather than the whole database being sent again next hour. A row with no title is skipped and reported. A modest batch is handled per run, so a backlog drains over a few hours instead of arriving at once.
Your database needs two properties: a text property called 'Todoist task', left empty, and a date property called 'Due date'. A row without a due date becomes a task with no date.
notionDatabaseId to blank.Set notionDatabaseId to blank.todoistProject to blank.Set todoistProject to blank.todoistProjectId to blank.Set todoistProjectId to blank.todoistProject isn't emptyIf todoistProject isn't emptytodoistProjects.List projects. Save it as todoistProjects.todoistProjectOption in todoistProjects:For each todoistProjectOption in todoistProjects:todoistProjectOption.name is todoistProject If todoistProjectOption.name is todoistProjecttodoistProjectId to todoistProjectOption.id.Change todoistProjectId to todoistProjectOption.id.todoistProjectId is blankIf todoistProjectId is blankplannedRows to an empty list.Set plannedRows to an empty list.notionErrorIf a step below fails, save the error as notionErrornotionDatabaseId. Save it as plannedWork.Find pages in notionDatabaseId. Save it as plannedWork.plannedRows to plannedWork.results.Change plannedRows to plannedWork.results.createdCount to 0.Set createdCount to 0.plannedRow in plannedRows:For each plannedRow in plannedRows:newTaskId to blank.Set newTaskId to blank.rowErrorIf a step below fails, save the error as rowErrorplannedRow.title and save it as taskName.Trim plannedRow.title and save it as taskName.dueDate to blank.Set dueDate to blank.noDueDateIf a step below fails, save the error as noDueDateplannedRow.properties["Due date"] and save it as dueValue.Trim plannedRow.properties["Due date"] and save it as dueValue.dueValue split by a space split by T and save it as dueDay.Get the first item of the first item of dueValue split by a space split by T and save it as dueDay.dueDay is 10 and dueDay contains -If the length of dueDay is 10 and dueDay contains -dueDate to dueDay.Change dueDate to dueDay.dueDate to blank.Change dueDate to blank.taskName is emptyIf taskName is emptySkipped a row in the Notion database because it has no title..Show in the output: Skipped a row in the Notion database because it has no title..taskName. Save it as createdTask.Create task taskName. Save it as createdTask.
Project ID: todoistProjectId
Due date: dueDatecreatedTask.id and save it as newTaskId.Trim createdTask.id and save it as newTaskId.plannedRow.title as text: rowError as text.Show in the output: Could not create a Todoist task for the Notion row plannedRow.title as text: rowError as text.newTaskId isn't emptyIf newTaskId isn't emptywriteBackErrorIf a step below fails, save the error as writeBackErrorplannedRow.Update plannedRow.createdCount.Add 1 to createdCount.plannedRow.title as text but could not write the task id back to that row, so the run stopped here rather than send the same work across again on the next run. Check that the database has a text property named exactly 'Todoist task' that Lodol is allowed to edit.Stop and report a problem: Created the Todoist task for the Notion row plannedRow.title as text but could not write the task id back to that row, so the run stopped here rather than send the same work across again on the next run. Check that the database has a text property named exactly 'Todoist task' that Lodol is allowed to edit.createdCount new row(s) from the Notion database to Todoist.Show in the output: Sent createdCount new row(s) from the Notion database to Todoist.