It is possible to implement such a complex logic in n8n?

I believe n8n is very powerful and allows one to do things without resorting to complex coding. And I am starting to like it.

I would request experts to advise me how to implement complex logic.

The logic that I want to use is as follows.

Call an API that will return around 100 items at each call depending on the criteria provided.

For every data item fetched using API I want to check if that item exist in database or not. If the data item exist in the database I want to check if its status and the status in the data received from API is same or different.

If the status is different then I want to check the database to see if any user is registered to the data item or not. Here there will be multiple users registered to one single data item. And one user can register to multiple data items.

If a user is registered to a data item I want to send the user a well formatted email informing the user that the status of the data item the user has registered to has been updated.

Then I will update the content in database.

My questions are:
What is the best way to implement such a complex login in a workflow?
Should I implement it using the type of nodes provided or should I add a Code Node and write the whole login in JavaScript inside this one single node?

I don’t think this is particularly complex. It should be doable without much custom code (in Code node). There might be huge performance gains if you could do some bulk sql (like checking all 100 items in a single SQL call).

I would probably end up with using mostly standard nodes and a few Code nodes. I would definately advice you against writing a lot of code inside the Code node. If you’re doing that you might as well write the entire thing outside N8N.

4 Likes

Thank you for your suggestion.

I will try to build something to see how it performs.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.