i want to build a workflow which takes every night emails from a certain outlook folder, generates a 1 sentence summary of the email with an openai node and puts all this in a message to me so I can digest the emails easily.
I get all the emails I want but I fail at 2 points:
1. As there could be quite a few emails / email bodies to process I want to throttle the processing in the openai node. Here I use a loop node but it seems that the output of the openai node is always the limit of 3 emails I put in. the loop node / openai node doesn’t seem to loop through the e.g. 20 email bodies to process. I tried merge node with append to collect all processed emails but failed.
2. Once all email bodies are processed, I need e.g. the from, subject und receivedDate, Emailurl in order to make a good summary of the emails. I don’t seem to be able to get a merge node to work and combine the openai results with the data from the outlook node.
Could anybody point me in the right direct as how to realize such a workflow? I’m completely new to n8n and maybe I haven’t got the logic right and try this a way that is “wrong” or overly complicated??
Here’s the best way I’ve seen to send multiple emails to openai. You can use an aggregate step, and a text step to combing all rows into one.
Here’s the workflow.
If this response helped you, please click the heart to show that it is useful If this response solved your issue, mark it as the solution to help the community
the thing is that i want to get a 1 sentence summary of the individual email and THEN aggregate into summary/digest email. Plus I want to throttle the openai summarize email step in order not to overload it. So my use case is different.
@rbreen thanks a bunch, this helped me a lot - apparently my info about the loop node was wrong. Perplexity kept tellimg me that I shouldn’t loop back from openai node and not use the done exit to continue. I think I was also reading it this way in the loop docu but won’t guarantee.
So, looping back into the loop node and using the done exit solved all my issues.
May I ask a follow up question? I try to mark the summarized emails with a category. But I fail as Microsoft Outlook update node seems to need a single id to do the update of the category. I’M currently trying to loop through the ids i get from the filter node I used to filter out emails with the “summaryW” category, which are (or will be!) already summarized. I cannot get the “by id” field/expression right. I tried {{$json[“id”]}} or {{ $(‘Filter SummaryW’).item.json.id }} (Filter SummaryW is the node which filters the summaryW category emails out).
Could you give me a hint on how to solve this? Thanks in advance for the awesome, awesome support here!!!
Try this. I renamed the field in step 2 and brought it through to the outlook step.
If this response helped you, please click the heart to show that it is useful If this response solved your issue, mark it as the solution to help the community
Not working for me because I exit the first “openai” node loop and process the summary, only after I have succesfully sent the email with the digest (collection of summarized emails), I want to change the category - which seems to bring me into trouble as I cannot seem to get the ids properly.
I just tried to set up a second loop with an set node with message id from the filter node before the loop and another set node between loop and ms outlook update node, but I keep getting the malformed id error. It seems the set node doesn’t generate an array(?) of the ids of the filtered emails.
Sorry for the questions, it’s my second day on n8n
so this is where I am, sorry there is some German, I haven’t been consistent with the language aus it work in progress.
I’m struggling to combine the if node with the execution of the category update. The category/tag update i could’t get to work at all in this workflow.
You need to update the category before the number of records go down to one. When you are sending the aggregate email, the number of rows goes down from 5 to 1 and doesn’t keep all 5 id’s.
Here’s a working workflow.
If this response helped you, please click the heart to show that it is useful If this response solved your issue, mark it as the solution to help the community
if you truely need the emails categorized after the true branch, you can merge it back in with the original outlook node.
If this response helped you, please click the heart to show that it is useful If this response solved your issue, mark it as the solution to help the community
@rbreen many, many thanks, this solved my issue and i can go in prodution with this. Awesome support for a newbie! I’m very excited about n8n and this support makes me feel I’m onto something great here! THANK YOU!