Asana - create task from gmail emails

Hi guys,
I want to create a workflow in n8n where I search for new emails with a specific tag and create a task in asana with them.

How do I make sure that n8n does not duplicate the task. I mean how to make sure that next time, when a workflow runs n8n, will not create a task from the email he did last time?

Thank you in advance.

Hey @Victor_Sava!

Before creating the new task you can use the Search operation in the Asana node to check if the task already exists. Based on the output you can then create a new task.

I guess this is gonna depend @Victor_Sava . Right off the top of my head, you have a couple of options.

1 - Use the Gmail build-in filters to retrieve the emails with a specificity tag and arrived in a specific time range. This way, you will not have to deal with duplication as, theoretically, you will always receive new emails. This, of course, has to be paired with the Cron job node.

2 - Use the IMAP Email Trigger so you will get notified every time an email arrives. The downside I see here it’s that you won’t be able to use tags. Perhaps, you can use another variable to choose the correct email.

3 - What @harshil1712 suggested works as long as you have a common id between the email and the tasks.

Ideally, we would have a Gmail Trigger that notifies every time an email with a particular tag arrives. Sadly this is yet not possible. We will be working on it soon, though.

1 Like

Hi ,
Thank you for your reply. In the end i did a cronjob that runs every 15 minutes and returns x emails.

For each email I receive i save the ID in PostgreSQL so that nextime when i try to create a task for a specific email, I check first if that gmail_id exists in database, if it does not exist i create a task otherwise it does nothing