cbrooker / MMM-Todoist

This is an extension for the MagicMirror2 platform. It will display your Todoist todos on your MagicMirror.
MIT License
151 stars 58 forks source link

New API version v9 #103

Open diappollo opened 1 year ago

diappollo commented 1 year ago

hi, I would like to use this app but obviously, it no longer works since the API was upgraded to v9, is an update planned? Thanks for the work anyway :)

soldatino13 commented 1 year ago

too bad...so this is the reason for the message: Todoist api request status=404

tkotz8105 commented 1 year ago

I've used this module on a number of my MagicMirrors and have dug in the past into the use of the api request. I won't have time to test it today but add apiVersion: "V9"' to your config.js file. This is an undocumented option for the config file. I'm sorry I can't test it first but I'll try it in the next couple of days. If you try it, let me know if it works. I hope it helps.

diappollo commented 1 year ago

Thank you for your feedback, I have already carried out several tests including that of modifying the MMM-Todoist.js apiVersion: "v8", apiBase: "https://todoist.com/API", todoistEndpoint: "sync", by (source : https://developer.todoist.com/sync/v9/#sync ) apiVersion: "v9", apiBase: "https://api.todoist.com", todoistEndpoint: "sync",

and I saw that too : https://developer.todoist.com/sync/v9/#migrating-from-v8

but, nothing works :(

diappollo commented 1 year ago

@tkotz8105 : were you able to test ?

For my part, impossible to make it work... anyone else have an idea? 😊

tkotz8105 commented 1 year ago

Just ran a test and it works for me ... with apiVersion: "v9". As part of the test, I added a console.log to node-helper.js to display the url used in the POST request and here's what I got

https://todoist.com/API/v9/sync/

Here's my config for MMM-Todoist: { module: 'MMM-Todoist', position: 'top_left', // This can be any of the regions. Best results in left or right regions. header: 'Tom\'s To Do List', // This is optional config: { // See 'Configuration options' for more information. accessToken: 'private', apiVersion: 'v9', projects: ['1540982268', '2181604909', '2175042369', '1541065892'], maximumEntries: 15, interval: 60, fade: false, showProject: false, sortType: "dueDateAsc", apiBase: "https://todoist.com/API" } },

diappollo commented 1 year ago

Thanks a lot ! it finally works!

jnicpon commented 1 year ago

Just ran a test and it works for me ... with apiVersion: "v9". As part of the test, I added a console.log to node-helper.js to display the url used in the POST request and here's what I got

https://todoist.com/API/v9/sync/

Here's my config for MMM-Todoist: { module: 'MMM-Todoist', position: 'top_left', // This can be any of the regions. Best results in left or right regions. header: 'Tom's To Do List', // This is optional config: { // See 'Configuration options' for more information. accessToken: 'private', apiVersion: 'v9', projects: ['1540982268', '2181604909', '2175042369', '1541065892'], maximumEntries: 15, interval: 60, fade: false, showProject: false, sortType: "dueDateAsc", apiBase: "https://todoist.com/API" } },

Thanks for this @tkotz8105! For others dealing with the v9 API issue, you must specify the projects or it will not return results.

fredriksundquist commented 1 year ago

it worked for me to just add " apiVersion: 'v9', " to the config-file

rkubik commented 1 year ago

The apiVersion did not work for me. I tried recreating a new API token in the web console but it kept saying that my session timed out and would log me out. I fixed this by creating a second account with a new API key.

mazim-co commented 1 year ago

Hey there - just want to say thank you. The change from v8 to v9 helped.

soldatino13 commented 1 year ago

Yes...I can confirm, it works. Thank you all

addfozzie commented 1 year ago

Hey all, Thanks for the pointers but im still having issues. Ive added apiVersion, apiBase (both addresses), todoistEndpoint and ensured projects are specified and in quotations. I have reset my access token and updated the config but still not working. Checking the log, im getting `"Todoist api request status=403" with the occasional 404 error.

fredriksundquist commented 1 year ago

Wierd.. my config only look like this: hideWhenEmpty: false, accessToken: 'testing acsesstokrn', apiVersion: 'v9', maximumEntries: 60, updateInterval: 10601000, // Update every 10 minutes fade: false,
// projects and/or labels is mandatory: projects: [ 16261627, 727726], labels: [ "MagicMirror", "Important" ] // Tasks for any projects with these labels will be shown. }

soldatino13 commented 1 year ago

Strange... After I updated the module, it doesn't work anymore. I'm getting the error "Todoist api request status=403"

dewwy1 commented 1 year ago

Similar situation as soldatino13. Installed todoist on the 22/12 and it worked with 2 lists and updated with new items as they were added by external source however stopped updating within 24 hours. Upon refreshing both lists stuck on "Loading" with log showing a 403 error which brought me to this thread.

I have tried all of the above and in every combination I can imagine (with v9, apibase as todoist.com.apu and api.todoist, without these, reinstalled mmm-todoist, new access token, new app with new access token, with and without labels and other config options) but no luck.

anyone have any ideas? I only started with magic mirror the other day so havent dug far past the config file.

karldonteljames commented 1 year ago

having the same issue. I initially thought I had made too many requests as I had set it to refresh every five minutes, but i guess this isn't the case if others are seeing this too.

I've tried using different the following end-points for the sync api:

https://api.todoist.com/sync/v9/
https://api.todoist.com/sync/v9/sync
https://api.todoist.com/sync/
https://api.todoist.com/

I've also tried the config file with and without the two options below.

apiVersion: "v9",
todoistEndpoint: "sync"

All of these variations result is either 403 or 404 errors.

I noticed that the latest commit says "Updated API version from v8 to v9" however from my very simple understanding the code in MMM-Todoist.js still has the defaults set to:

apiVersion: "v9",
apiBase: "https://todoist.com/API",
todoistEndpoint: "sync",
vadincarai commented 1 year ago

I found the latest solution to the 403 error in an article on the Todoist Google Group.

https://groups.google.com/a/doist.com/g/todoist-api/c/sqrGTtCr-4A

I've never updated the GIT codebase myself so I'll just put the solution here and hopefully someone else can update the codebase.

In node_helper.js in MMM-Todoist, starting on line 36:

Old: headers: { "content-type": "application/x-www-form-urlencoded", "cache-control": "no-cache" }, form: { token: self.config.accessToken, sync_token: "*", resource_types: self.config.todoistResourceType }

New: headers: { "content-type": "application/x-www-form-urlencoded", "cache-control": "no-cache", "Authorization": "Bearer " + self.config.accessToken }, form: { sync_token: "*", resource_types: self.config.todoistResourceType }

dewwy1 commented 1 year ago

New: headers: { "content-type": "application/x-www-form-urlencoded", "cache-control": "no-cache", "Authorization": "Bearer " + self.config.accessToken }, form: { sync_token: "*", resource_types: self.config.todoistResourceType }

This worked a charm, well done finding that. Similarly going to opt out of updating the codebase as I'd definitely get something wrong.

mazim-co commented 1 year ago

Good catch @vadincarai! 🎣 It works, thank you very much for sharing.

Divinitous commented 1 year ago

I found the latest solution to the 403 error in an article on the Todoist Google Group.

https://groups.google.com/a/doist.com/g/todoist-api/c/sqrGTtCr-4A

I've never updated the GIT codebase myself so I'll just put the solution here and hopefully someone else can update the codebase.

In node_helper.js in MMM-Todoist, starting on line 36:

Old: headers: { "content-type": "application/x-www-form-urlencoded", "cache-control": "no-cache" }, form: { token: self.config.accessToken, sync_token: "*", resource_types: self.config.todoistResourceType }

New: headers: { "content-type": "application/x-www-form-urlencoded", "cache-control": "no-cache", "Authorization": "Bearer " + self.config.accessToken }, form: { sync_token: "*", resource_types: self.config.todoistResourceType }

Thank you. I spent way too much time trying to figure this out. It worked for me for a few hours then completely failed on me. This resolved the issue.

IrocStan commented 1 year ago

I found the latest solution to the 403 error in an article on the Todoist Google Group.

https://groups.google.com/a/doist.com/g/todoist-api/c/sqrGTtCr-4A

I've never updated the GIT codebase myself so I'll just put the solution here and hopefully someone else can update the codebase.

In node_helper.js in MMM-Todoist, starting on line 36:

Old: headers: { "content-type": "application/x-www-form-urlencoded", "cache-control": "no-cache" }, form: { token: self.config.accessToken, sync_token: "*", resource_types: self.config.todoistResourceType }

New: headers: { "content-type": "application/x-www-form-urlencoded", "cache-control": "no-cache", "Authorization": "Bearer " + self.config.accessToken }, form: { sync_token: "*", resource_types: self.config.todoistResourceType }

Thank you so much for sharing, my MagicMirror is now working great again! Have simply bracketed out the obsolete lines with "/ and /" and added the new ones, it runs!

MMM-Todoist

diappollo commented 1 year ago

Thank you very much for your sharing, since it works perfectly on my side!

BGH-H commented 1 year ago

Im late to the party but my Todoist is stuck on loading. Ive read the posts above, but can someone explain to me what steps I need to take in oder for me to get this working?

Current coding since last christmas:

{ module: 'MMM-Todoist', position: 'bottom_right', // This can be any of the regions. Best results in left or right regions. classes: 'scheduler', header: 'Shoppinglist', // This is optional config: { // See 'Configuration options' for more information. hideWhenEmpty: false, accessToken: 'private', maximumEntries: 10, updateInterval: 10601000, // Update every 10 minutes showProject: false, // projects and/or labels is mandatory: projects: [ 2XX3X17XX ], labels: [ "MagicMirror", "Important" ], // Tasks for any projects with these labels will be shown.

} },

Ive tried adding api V9 and api base , then it looks like: { module: 'MMM-Todoist', position: 'bottom_right', // This can be any of the regions. Best results in left or right regions. classes: 'scheduler', header: 'Shoppinglist', // This is optional config: { // See 'Configuration options' for more information. hideWhenEmpty: false, accessToken: 'private', maximumEntries: 10, updateInterval: 10601000, // Update every 10 minutes showProject: false, apiVersion: 'v9',
// projects and/or labels is mandatory: projects: [ 2XXXXXXXX ], labels: [ "MagicMirror", "Important" ], // Tasks for any projects with these labels will be shown. apiBase: "https://todoist.com/API" } },

Can someone point me in the right direction? If I need to post aditional info, please explain how I extract this data. Many many thanks. B

mazim-co commented 1 year ago

Hi @BGH-H - first have you already pulled the most recent update?

Open the console and:

cd MagicMirror/modules/MMM-Todoist
git pull
BGH-H commented 1 year ago

thanks @ mazim-co. The update was enough to get it to work again. Many thanks.

waterglass11 commented 1 year ago

Hi all,

First time poster (like many others in the thread). I tried the manual updates vadincarai originally suggested, and I've made sure to update to the Dec 28th commit, and neither method is working. I'm still seeing "Loading..." but at least I'm not getting any errors in the console anymore!

I've tried remaking the OAuth token, and adding/removing manually added code, and nothing seems to move it from "Loading..." status. I'm currently sitting with vanilla code from the latest commit, my config.js has the example code from here on github (with my token added in), and I'm hoping someone can help me figure this out. Did I miss a step somewhere?

waterglass11 commented 1 year ago

Hi all, any thoughts on the above post? I've tried a bunch of times, including reinstalling the whole magicmirror and only having this module present, and still just see "Loading..." any ideas on what could be the cause?

waterglass11 commented 1 year ago

Just kidding - sort of good news here, I got it fixed! I had been running in Docker but that version must be way out of date. I built MagicMirror back up from scratch using the github version and now it works perfectly!