/roamist

Primary LanguageTypeScriptMIT LicenseMIT

Todoist ❤️ Roam Research

🚧 WORK IN PROGRESS 🚧

This is a work in progress, and breaking changes to the setup/config could occur in the future. If you have any trouble, don't hesitate to create new Issues or contact me on the #roamist channel on Roam Slack. Sorry for any inconvenience.

CleanShot.2022-01-21.at.23.49.40.mp4

Table of Contents

Motivation

I have been using Todoist as my task management tool for a long time.
I still think that Roam Research is the best note-taking tool, but Todoist is more suitable for task management.

Since I started using Roam Research, I've wondered if it would be possible to use Todoist for task management but take detailed notes for each task in Roam Research.

This Roamist is one way to make this possible. With this integration, you can copy tasks from Todoist to Roam Research, complete Todoist tasks from within Roam Reasearch, and synchronize task completion status between Todoist and Roam Reserach.

Prerequires

Setup

window.TODOIST_TOKEN = "put your todoist token"; // Please replace with your token
window.Roamist = {};
window.Roamist.TODOIST_TAG_NAME = "Roamist"; // Please replace here with any tags what you want to use for this integration.
const ID = "roamist";
const existing = document.getElementById(ID);
if (!existing) {
  const script = document.createElement("script");
  script.src = "https://kdnk.github.io/roamist/dist/roamist.umd.js";
  script.id = ID;
  script.defer = true;
  script.type = "text/javascript";
  document.getElementsByTagName("head")[0].appendChild(script);
}

⚠️ All tasks pulled from Todoist should have a specific tag you set via window.Roamist.TODOIST_TAG_NAME.
This tag is essential because this integration uses the tag to recognize which blocks come from Todoist.
I recommend you don’t change it once you set this tag.
See also workflows section for more details.

Add workflows for SmartBlocks

⚠️ You should already have the page named roam/js/smartblocks if you followed Setup section.
If not, make sure you set up SmartBlocks correctly first.

  • Paste some workflows what you like under workflows block on [[roam/js/smartblocks]].
    • After finishing setup, your [[roam/js/smartblocks]] page should look like this.

screenshot

  • Then, you can use these workflows typing your SmartBlocks trigger (I use jj for it).

sceenshot

Workflows

⚠️ This integration recognizes the Todoist id using a tag like Todoist/1234567890.
You must NOT remove this tag.
If you do, this integration won't work as intended.

pull tasks

  • This workflow will pull tasks with the Todoist's Filters.
  • Block will look like this.
    • image
  • This command should work in any pages.
  • arguments
    • todoistFilter
      • You can pass your filter here.
    • onlyDiff
      • If you pass true, this workflow pulls only tasks which don't exist in the current page.
- #SmartBlock todoist - pull daily today
    - <%JAVASCRIPTASYNC:```javascript
(async function () {
  await window.Roamist.pullTasks({ todoistFilter: "(#🧘Routine & #🦒Personal) & today", onlyDiff: false });
})();
```%>

sync completed

⚠️ I assume we use this workflow in [[42Todoist]] page or the page you set via window.Roamist.TODOIST_TAG_NAME.

  • This workflow will sync completion status from Todoist to Roam Research.
  • If there are blocks which are already completed in Todoist, {{[[TODO]]}} part in Roam Research will be changed to {{[[DONE]]}} automatically just pressing this button.
  • I recommend you use this workflow as a button in [[42Todoist]] as follows.
    • {{Sync todoist completed:42SmartBlock:todoist - sync completed:button=true,42RemoveButton=false}}
    • CleanShot 2022-01-22 at 00 00 59
- #SmartBlock todoist - sync completed
    - <%JAVASCRIPTASYNC:```javascript
(async function () {
  await window.Roamist.syncCompleted();
})();
```%><%NOBLOCKOUTPUT%>

complete task

  • This workflow will complete a task under your cursor.
    • After running this workflow, {{[[TODO]]}} will turn into {{[[DONE]]}} automatically.
- #SmartBlock todoist - complete task
    - <%JAVASCRIPTASYNC:```javascript
(async function () {
  await window.Roamist.completeTask();
})();
```%>

roam/css for priority

- #priority/p1 #priority/p2 #priority/p3 #priority/p4
    - ```css
    @import url('https://kdnk.github.io/roamist/src/css/priority.css');
    ```

Inspired