Open mlava opened 3 years ago
This is great! The only feature I miss is support for todoist dates. Is this information available in the API?
Hi everyone. There have been lots of queries about how this script is intended to work, and it occurs to me that I should have clarified the design brief before working on it. I assumed I knew what people meant in the thread about using Todoist inbox as a Quick Capture replacement for the inbuilt Roam Research one, but lots of questions suggest that maybe it isn't as clear as I thought. https://roamresearch.slack.com/archives/C0190JLGDUJ/p1610276819246200 So, here are some explanations for design choices that I hope will help. This can also be used as a starting point for discussion, as I am open to tweaking if there is agreement.
New version 0.1.5 Beta in first post.
Fantastic work on this!
For anyone who just really wants to have due dates come across as well, this is pretty easy to do.
First, copy and past this code immediately following the var
s at the top of the code block in the TQC - Todoist QC Inbox
SmartBlock.
function convertToRoamDate(dateString) {
var parsedDate = dateString.split('-');
var year = parsedDate[0];
var month = Number(parsedDate[1]);
const months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var monthName = months[month-1];
var day = Number(parsedDate[2]);
let suffix = (day >= 4 && day <= 20) || (day >= 24 && day <= 30)
? "th"
: ["st", "nd", "rd"][day % 10 - 1];
return "[[" + monthName + " " + day + suffix + ", " + year + "]]";
}
Then, replace this line - which occurs in two places
roam42.common.setEmptyNodeValue(document.activeElement, "" + task.content) + " #[["+TodoistImportTag+"]]" );
with this
if (task.due) {
roam42.common.setEmptyNodeValue(document.activeElement, "" + task.content + " " + convertToRoamDate(task.due.date)) + " #[["+TodoistImportTag+"]]" );
} else {
roam42.common.setEmptyNodeValue(document.activeElement, "" + task.content) + " #[["+TodoistImportTag+"]]" );
}
You should end up with something like this.
For anyone who just really wants to have due dates come across as well, this is pretty easy to do.
First, copy and past this code immediately following the
var
s at the top of the code block in theTQC - Todoist QC Inbox
SmartBlock.function convertToRoamDate(dateString) { var parsedDate = dateString.split('-'); var year = parsedDate[0]; var month = Number(parsedDate[1]); const months = ['January','February','March','April','May','June','July','August','September','October','November','December']; var monthName = months[month-1]; var day = Number(parsedDate[2]); let suffix = (day >= 4 && day <= 20) || (day >= 24 && day <= 30) ? "th" : ["st", "nd", "rd"][day % 10 - 1]; return "[[" + monthName + " " + day + suffix + ", " + year + "]]"; }
Then, replace this line - which occurs in two places
roam42.common.setEmptyNodeValue(document.activeElement, "" + task.content) + " #[["+TodoistImportTag+"]]" );
with this
if (task.due) { roam42.common.setEmptyNodeValue(document.activeElement, "" + task.content + " " + convertToRoamDate(task.due.date)) + " #[["+TodoistImportTag+"]]" ); } else { roam42.common.setEmptyNodeValue(document.activeElement, "" + task.content) + " #[["+TodoistImportTag+"]]" ); }
You should end up with something like this.
There were some issues with the closed parens. This change fixed and allowed the script to work in the new beta:
if (task.due) {
roam42.common.setEmptyNodeValue(document.activeElement, "" + task.content + " " + convertToRoamDate(task.due.date) + " #[["+TodoistImportTag+"]]" );
} else {
roam42.common.setEmptyNodeValue(document.activeElement, "" + task.content + " #[["+TodoistImportTag+"]]" );
}
Thanks, @lifsys. Yep. I made that mistake in preparing to post it here. Appreciate you helping others with this.
Thanks, @lifsys. Yep. I made that mistake in preparing to post it here. Appreciate you helping others with this.
@eatondpe, the least I can do. You all make this magic possible!
Updated code to (hopefully) fixed the dropped items reported by Jason Philips on Slack...
I removed the import tag and found items were given #[[]]
by default. I know you were wary of adding more configuration, but would there be a way of including no tag if the setting was blank? It's a little cumbersome deleting the tag for every import. I'm still hoping that someone will develop a Workflowy style action to delete tag by alt-click.
@kmaustral
Remove this string from lines 25 and 51 of the TQC - Todoist QC Inbox code block.
#[["+TodoistImportTag+"]]
Note the space ahead of the #
Thanks Mark. I get that string on lines 34, 39, 63, 73,78 and 83. Sorry if I misinterpret.
Hi Kevin. I think you're using an old version. Latest is 0.1.7 beta. Suggest update to latest and then change lines 25 and 51. Don't forget to backup your config somewhere else before deleting the SB page and re-importing. Cheers. Mark
Fine. I updated and removed the tag. Nice and clean. Thanks Mark.
Updated to v0.18 - see first post
This version includes advanced settings configuration options to:
Each of these is set to False as default and need to be enabled by changing the setting to True.
New version 0.1.9 beta
Download in first post.
Hi Mark. It would be great if there was a way to import attachments as links. That way we could access the content of emails.
And can you remind me if there is a setting to delete imported tasks from Todoist. I've uploaded the latest version and can't find that setting.
Thanks for all your work.
Hi Kevin, It should be automatically deleting the tasks from Todoist. Is that not happening??
Do you have premium or free? With premium you can import attachments.
It's not deleting at the moment, but that might be temporary.
Todoist generously has just allowed attachments for the free plan: https://todoist.com/help/articles/whats-included-in-the-new-free-plan
On Wed, 14 Apr 2021 at 08:58, Mark Lavercombe @.***> wrote:
Hi Kevin, It should be automatically deleting the tasks from Todoist. Is that not happening??
Do you have premium or free? With premium you can import attachments.
ā You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/roamhacker/SmartBlocks/issues/187#issuecomment-819104598, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARTR6NYCDEFQS4EM5SGVNZLTITEABANCNFSM4WIJOP7A .
Mark, I can download the first task, but not the others. The first task is not deleted from Todoist.
Kevin, I just tested again and it's working for me with both free and premium accounts. Is there anything in the console? Cheers, Mark
On Wed, Apr 14, 2021 at 9:50 PM kmaustral @.***> wrote:
Mark, I can download the first task, but not the others. The first task is not deleted from Todoist.
ā You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/roamhacker/SmartBlocks/issues/187#issuecomment-819457794, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUKIPSIIWPZ6N24OJVDOQ3TIV6QHANCNFSM4WIJOP7A .
I couldn't locate anything specific, but I'm not sure what I would be looking for. Should this setting be filled out even if you are not tagging items: #42Setting TodoistImportTag
Not sure if I included logic. Maybe just add a tag and let me know what happens?
On Fri, Apr 16, 2021 at 9:19 AM kmaustral @.***> wrote:
I couldn't locate anything specific, but I'm not sure what I would be looking for. Should this setting be filled out even if you are not tagging items:
42Setting TodoistImportTag
ā You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/roamhacker/SmartBlocks/issues/187#issuecomment-820793975, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUKIPXNLICUU4AJHNMIYT3TI5YB7ANCNFSM4WIJOP7A .
unfortuantely the {{button}} block which includes 42RemoveButton=false, keeps disappearing after successfully imports tasks from todoist. Any solutions? My usual workaround which was adding an empty bulletpoint under the UQC script doesn't help
Now it works, added two blanks as parents and that did the job:
(blank) (blank) <%JAVASCRIPT...
I haven't changed anything on my configuration but starting a few days ago I'm getting this when I run this block:
Block threw an error while running: <%JAVASCRIPTASYNC: ```javascript
var myToken = ...
Is anyone else seeing this and is there a way to get more detail than just this truncated error message?
Have the same issues because of smartblock V2
@mlava, do you know if SmartBlocks V2 caused this? If so, is this amazing tool being worked on? No worries if not, I just wanted to check before looking for another tool. š
I;ve uploaded a new version t the marketplace
Thanks @mlava! The RoamJS marketplace? I'm not seeing it there yet, is that where you mean?
Yep, RoamJS marketplace. I just checked and it's in there for me. Maybe refresh your roam?
Found it. I wasn't looking on the SmartBlock store, but the marketplace that is part of the roamjs website.
Glad you're getting a few bucks for this great integration now, thanks for the update!
On the contrary I now found it on the Smartblocks-Store :) But you should post a documentation in the store. Because for me the addon initially didnt work because I had both versions (the one here and the one from the store) "installed". I figured out that you have to put in all the data again in the new addon (which of course makes sense after thinking about it), but it nevertheless took me 10 minutes or so to make it running again because there is no documentation. And the link in the description in the smartblock store cannot be opened (at least I dont have access there).
Thank you. I've updated the description in the store to point to this Github issue. Hopefully, people will be able to get it working.
On Sun, Oct 31, 2021 at 4:29 PM WalterChr @.***> wrote:
On the contrary I now found it on the Smartblocks-Store :) But you should post a documentation in the store. Because for me the addon initially didnt work because I had both versions (the one here and the one from the store) "installed". I figured out that you have to put in all the data again in the new addon (which of course makes sense after thinking about it), but it nevertheless took me 10 minutes or so to make it running again because there is no documentation. And the link in the description in the smartblock store cannot be opened (at least I dont have access there).
ā You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dvargas92495/SmartBlocks/issues/187#issuecomment-955639836, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUKIPSRBA4L5MG422O3CBDUJTH3RANCNFSM4WIJOP7A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I recently bought the plugin through the SmartBlocks store.
Inbox items pull in from Todoist fine but they are NOT removed from the Todoist inbox.
Have you encountered this before / have any ideas for solving it?
Hi Mark. Thank you. I haven't seen this, but am going to start experimenting and see if I can reproduce it. A couple of questions: Are the tasks that aren't being removed pulled into Roam again the next time you call the SB? Could you please open Console (F12 in many browsers) and go to the Errors section. Then, call the SB and see if any errors appear. If there are, please screenshot or record a Loom for me? Thanks in advance, Mark
Hi Mark,
Thanks for getting back to me so quickly. Responses below.
Thanks for your help!
Mark
On Wed, Nov 17, 2021 at 21:03:27, Mark Lavercombe @.***> wrote:
Hi Mark. Thank you. I haven't seen this, but am going to start experimenting and see if I can reproduce it. A couple of questions: Are the tasks that aren't being removed pulled into Roam again the next time you call the SB? Could you please open Console (F12 in many browsers) and go to the Errors section. Then, call the SB and see if any errors appear. If there are, please screenshot or record a Loom for me? Thanks in advance, Mark
ā You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dvargas92495/SmartBlocks/issues/187#issuecomment-972020879, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGJXYW3QRBG2ANE6SNUMZDUMQKB7ANCNFSM4WIJOP7A .
Hi Mark. That error looks pretty worrying. CORS issues often aren't fixable without creating a nodejs server as a middleman. How wedded are you to using Roam in the Desktop app? I will experiment with trying the other Todoist API from the desktop app and see if I can progress. It might take me a little bit of time. Cheers, Mark
Hi Mark,
While I primarily use the Roam Desktop app, I took the screenshot from a Chrome window (not sure if that makes a difference).
I prefer the Desktop App to having Roam in a Chrome window, though I'm happy to experiment with other solutions. Out of curiosity, what's your current setup, or popular setups that others use?
Mark
On Thu, Nov 18, 2021 at 04:18:32, Mark Lavercombe @.***> wrote:
Hi Mark. That error looks pretty worrying. CORS issues often aren't fixable without creating a nodejs server as a middleman. How wedded are you to using Roam in the Desktop app? I will experiment with trying the other Todoist API from the desktop app and see if I can progress. It might take me a little bit of time. Cheers, Mark
ā You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dvargas92495/SmartBlocks/issues/187#issuecomment-972524060, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGJXYTMN67JU6NJDOLC4BDUMR5BRANCNFSM4WIJOP7A .
āļø Copy of your #42SmartBlock from Roam
Please download the latest code: Universal Quick Capture for Roam Research.zip
š Describe the SmartBlock
This SmartBlock allows you to utilise the excellent Todoist Quick Capture mechanisms as an alternate Quick Capture to the inbuilt Roam Research one. You can capture thoughts, notes and ideas using the Todoist app, popular voice assistants and email into Todoist.
All of that data can now be imported into Roam Research.
ā Describe any prerequisites or dependencies that are required for this SmartBlock
Roam42 obviously. A Todoist account. This script works with Free and Premium Todoist accounts. Free users can't import comments or attachments (Todoist API limitation). Premium users can also assign a label in their Todoist inbox to only import certain items and not the whole inbox, which is useful if you already use Todoist in its own right.
š· Screenshot of your #42SmartBlock workflow/template from Roam
š” Additional Info
Import this json file to start: Universal Quick Capture for Roam Research.zip