IMAP node: Detect email conversation history

We’re trying to automate incoming emails to be put automatically into Monday. For this, we’re using the IMAP trigger node. But we’re having trouble with identifying the latest update and the rest of the email (history of the conversation). We only want the latest message to be added as an update in the item, otherwise it’d add the same history over and over. My email client can perfectly detect that, since it shows the conversation in blocks per email. Is there some kind of patern to detect this or how can we identify the latest message in the conversation?

Hi @OpenSourceSimon, do you mean you want to cut off the conversation history from a single message?

If so I’d take a look at perhaps the most recent 10 emails you have processed and see which headers they use to separate the “history” part from the new part. Gmail for example will use something like On Sat, Nov 11, 2023 at 10:20 AM Thomas Martens <[email protected]> wrote:.

You can then use this to split up your email bodies using a suitable regular expression. For example like so:

Hey @MutedJam, thanks for your reply! Unfortunately the email doesn’t always have ‘On (date) and name’. Especially with different languages. But the history can be found by looking at the blockquote HTML tag.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.