Need a way to compare and filter out data to forward

Hello everyone. I’m a new user of n8n.
I have been working on a workflow that fetches new posts from a subreddit and posts it to my discord via a webhook. What I would like to know is if there is a way to ensure that the same post doesn’t get resent to me if there are no new posts on the subreddit.

You have two ways to do this:

  1. Filter Reddit posts by date (better):
  • You can execute your task every 5 minutes.
  • Filter Reddit posts by date, and publish new entries in the last 5 minutes.
  1. Save your published posts to Google Sheets:
  • Append recovered posts from Reddit in a Google sheet.
  • Add a node to recover Google sheet entries and discard previously published posts.
1 Like

I actually tried something

I’ll explain
in the first node, it fetches the 10 latest posts from a subreddit
then it checks for a flair, if the flair is true, it writes the data in a Google Sheet, which is read in the Merge node along with another sheet that I have attached to be read at merge and store the output after the messages are sent to discord.
That way the data that is sent to the discord, is stored in the sheet. It should be read, compared with the data fetched from the first sheet, and in theory it should discard the posts that have already been sent. However, it isn’t doing that, it runs like a loop as if there are no rules and nodes at all. It just send me the posts again and again everytime I run the workflow.

It seems that merge doesn’t work well.

I recommend you checking that keys in both inputs have the same type (check JSON view and share it).

If they have different types, merge won’t work.

The key type is definitely the same.


If Merge doesn’t work properly, is there an alternative to achieve the intended output ?

Ok. But I mean values on the JSON view (isntead of the names of the fields).

Both are string or numbers? Check values when getting data in JSON view and share them.

Here you go
I remember setting their types to string