Compare workflow execution data

Hi there,

I am trying to search tweets from twitter and send over to gsheet periodically. I have managed to get the basic workflow of searching twitter and retrieving the relevant tweets to gsheet.

The questions are:

  1. While doing it periodically I do not want to save the same tweet again. Therefore, how do I compare the results of this execution vs the previous?
  2. If a delta is found in the comparison above I’d like to insert these to top of the gsheet. Is it possible to achieve this from within n8n?

Can you please point me to sample workflows or code if available?

Thank you.

Hey @ronykris!

This workflow will be helpful:

You can always look-up for workflows shared by the community on the Workflows page :wink:

1 Like

Hey @harshil1712

Thank you for the pointer, but for some reason it’s not working. In my scenario, there weren’t new tweets at the time of 2nd execution of the workflow. Therefore, I did not expect tweets to be sent out. However, it sent the tweets whatever was retrieved though it was sent in the previous execution.

Any recommendations?

All I have to do is compare the tweet IDs retrieved by the current execution with the tweet IDs of the previous execution. It’s as simple as that.

Hey! Did you try running it in production (activating the workflow)? During the development phase (when the workflow is not active), the getStaticData method returns everything. So it would also return the tweets that were fetched earlier.

Yes it was activated. That’s why I wonder if I am messing up somwehere.

That’s interesting. Can you share the code you’re using in the Function node?

It’s the same workflow you sent the other day to filter out the recent tweets. Just that I’m sending it to telegram as opposed to mattermost. Which is why I wonder where could I have gone wrong.

I tested the workflow and it is working as expected. How are you referencing the data in the Telegram node?

In the text field of the telegram I have referenced it to {{$node[“Function”].json[“tweet”]}}
because I need only the tweet text.

Can you try with $json["tweet"]?

Thank you. I will give it a try. May be that’s where it’s getting goofed up.
By the way, I am not good at js, do you support another language in your function nodes, like python?

You can run Python in n8n! However, to do that, you will have to build a custom image with Python installed. You can refer to this post to get some more information: Running Python with n8n