Hello, I am working on auto-filter workflow through which 10k emails/day are passed, with the trigger being of every hour.
The workflow has certain keywords to identify specific emails. These emails then are passed through a ChatGPT node to further classify into certain categories. I have two branches below with loops,
Loop 1 - Directly adds the email data
- Sender 2. Reciever 3. Date & Time(of email) 4. Subject Line 5. Body 6. Message ID 1 7. Keyword 8. Date Data Fetched(of workflow) 9. Time Data Fetched (of workflow)
Loop 2- Passes the email through ChatGPT to make certain classification
- Email Type 2. Escalation? 3. Experience Category 4. Severity 5. Experience Detail 6. Message ID 2
Now Loop 1 has append operation on a google sheet, while loop 2 has Append or update operation where the ‘Message ID 1’ is used to map column. ‘Message ID 1’ and ‘Message ID 2’ are same data point just being fetched from different nodes which I have added to validate further if the output from ChatGPT is of the correct email
Challenge
While for most emails this workflow works perfect for certain emails the row is either filling data of Loop 1 or Loop 2. I have validated that data is missing for those emails from either loop, and not that the loop are adding data in different rows, as the Message ID would match for both rows.
My requirement is to get the data for the email along with the ChatGPT output. I am completely fine if this can be done in a single loop, instead of two.
(I am avoiding adding a part in my prompt asking ChatGPT output to have loop 1 data, as my current input token size for each email is just below 1000, and output token is below 50. Workflow identifies around 500 emails each day, hence I don’t want double my API cost)
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: