Todoist, webhooks & If nodes

Hello!

First post here — I’m glad to be joining of the community!

I’m setting up my first workflows on my self-hosted n8n instance.
So far I have created two workflows, one to create a new tasks in Todoist every time I create a new Page in a specific Notion database, and one working the other way around (Todoist > Notion) that’s using the Todoist webhook.
So far, so good.

Now, I would like to tackle updates.
When I update (say add a due date to) a task in Todoist I’d like the corresponding Notion Page property to be updated.
I’m not quite sure how to handle this:

  1. Do I actually need to create a seperate workflow from my initial one that deals with newly created items?

  2. Or should I rather host both task on the same workflow? (both = new items and update items)
    In this case should I ask setup the Todoist webhook to watch for “item:updated” as well as “item:added” ? (see screenshot below)

  1. I figure that if you answer yes to the previous question, I might have to use an If node to differentiate events brought by the webhook that are new and those that are mere updates. If my intuition’s right, can you clue me as to how to set it up?

n8n is a bit of a learning curve but geez it’s worth it!
Looking forward to reading your comments.

Best,
BaptisteB

Hey @BaptisteB, welcome to the community :tada:

On a very basic level I’d say there is no right or wrong here. Both approaches will work, assuming Todoist allows multiple webhooks. If that’s not the case or if you’d like to keep all things Todoist in a single n8n workflow, you could use an IF node to check for which event a webhook has arrived.

From looking at Sync API Reference | Todoist Developer it seems the name of the event comes through in an event_name field inside the webhook body. So you might want to manually execute your workflow and then send a Todoist webhook to your webhook test URL. This should give you some suitable data in the n8n canvas to build out your IF condition from.

Thank you @MutedJam !

Using an IF node seems to make a lot of sense here and the event_name field is just what I needed.

1 Like

Excellent, glad to hear this helped! Thanks a lot for confirming :slight_smile: