Hey! I am trying to acheieve an auto-filter for emails where I can get an output of specific emails details where the subject or body has specific keywords.
Currently I am stuck at a step where I am unable to setup a spliter properly and reference the values directly so I don’t face the challenge that I am only getting values of 1 email in return.
Please share your workflow
n8n version: [email protected]
Database : SQLite (default)
EXECUTIONS_PROCESS setting: Main
Running n8n: via desktop app
Operating system: Windows 10
My expectation would be if there are 200 emails that are scanned in 1 hour, of which 10 have the respective keywords. All those 10 emails subject, body, receiver email, sender email, date and time, and ID details are updated on the google sheet every hour without any manual intervention.
This approach processes each matching email as a separate item, allowing all 10 matching emails (out of your 200) to be added to your Google Sheet in a single workflow run.
Make sure your function node that checks for keywords returns the full email object along with your match result.
I have create this test workflow to check this for 50 emails that were fetched after 4 PM today, before I implement this in my main workflow.
Is the loop over items correct or does it have to go through the complete workflow? I think I am doing something wrong that is resulting in the data to not split correctly
is there a reason why you are checking the matching in a code block,
A better solution would use the n8n nodes to check if they are unique and then use it to check if indiviallity and adding of keyword.
Yes, primary reason is I have 74 keywords currently and the list might expand in near future, so I thought this would be most optimized route versus a filter.
Also note I realized in my previous reply I missed to update the function to return email details I require apart from the KeywordFound, that I have updated. Open to suggestion if ther is any better solution to have an ever-expanding list of keywords.
Currently the gsheet tagging is working finally, thanks for the guidance!
Yes, this exactly! And after some tweaking I was able to run the it correctly. You suggestion to return the email data with the function was the key, as I was simple using the function as filter getting the ‘true’ as an answer and then referencing gmail node, instead of getting the data directly passed via the function node to the filter node, and then to the loop.